Mostly revert r219468, as I had misremembered the C standard regarding

the size of an extern array.

Keep one change from strncpy to strlcpy.
This commit is contained in:
Matthew D Fleming 2011-03-11 18:56:55 +00:00
parent e6bcbac1f7
commit c77715ef6c
6 changed files with 6 additions and 6 deletions

View File

@ -1758,7 +1758,7 @@ hammer_time(u_int64_t modulep, u_int64_t physfree)
env = getenv("kernelname");
if (env != NULL)
strlcpy(kernelname, env, MAXPATHLEN);
strlcpy(kernelname, env, sizeof(kernelname));
#ifdef XENHVM
if (inw(0x10) == 0x49d2) {

View File

@ -792,7 +792,7 @@ ia64_init(void)
p = getenv("kernelname");
if (p != NULL) {
strlcpy(kernelname, p, MAXPATHLEN);
strlcpy(kernelname, p, sizeof(kernelname));
freeenv(p);
}

View File

@ -540,7 +540,7 @@ powerpc_init(vm_offset_t startkernel, vm_offset_t endkernel,
*/
env = getenv("kernelname");
if (env != NULL) {
strlcpy(kernelname, env, MAXPATHLEN);
strlcpy(kernelname, env, sizeof(kernelname));
freeenv(env);
}

View File

@ -532,7 +532,7 @@ sparc64_init(caddr_t mdp, u_long o1, u_long o2, u_long o3, ofw_vec_t *vec)
init_param2(physmem);
env = getenv("kernelname");
if (env != NULL) {
strlcpy(kernelname, env, MAXPATHLEN);
strlcpy(kernelname, env, sizeof(kernelname));
freeenv(env);
}

View File

@ -425,7 +425,7 @@ sparc64_init(caddr_t mdp, u_long o1, u_long o2, u_long o3, ofw_vec_t *vec)
env = getenv("kernelname");
if (env != NULL) {
strlcpy(kernelname, env, MAXPATHLEN);
strlcpy(kernelname, env, sizeof(kernelname));
freeenv(env);
}

View File

@ -55,7 +55,7 @@
/* Global variables for the kernel. */
/* 1.1 */
extern char kernelname[/*MAXPATHLEN*/];
extern char kernelname[MAXPATHLEN];
extern int tick; /* usec per tick (1000000 / hz) */
extern int hz; /* system clock's frequency */