From: millert Date: Tue, 21 Jan 1997 04:52:44 +0000 (+0000) Subject: Remove unnecesary local changes. The strncpy()'s are safe because X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=a7a49c4293632f928f852ca6367d4e74574dd170;p=openbsd Remove unnecesary local changes. The strncpy()'s are safe because the string is static and so the last element is always init'd to zero. --- diff --git a/lib/libc/time/localtime.c b/lib/libc/time/localtime.c index a7cdae4a063..5546e0e3c74 100644 --- a/lib/libc/time/localtime.c +++ b/lib/libc/time/localtime.c @@ -7,7 +7,7 @@ #if 0 static char elsieid[] = "@(#)localtime.c 7.59"; #else -static char rcsid[] = "$OpenBSD: localtime.c,v 1.8 1997/01/14 03:16:47 millert Exp $"; +static char rcsid[] = "$OpenBSD: localtime.c,v 1.9 1997/01/21 04:52:44 millert Exp $"; #endif #endif /* LIBC_SCCS and not lint */ @@ -294,7 +294,7 @@ register struct state * const sp; if (!doaccess && issetugid() == 0) { if ((p = TZDIR) == NULL) return -1; - if ((strlen(p) + strlen(name) + 2) >= sizeof fullname) + if ((strlen(p) + strlen(name) + 1) >= sizeof fullname) return -1; (void) strcpy(fullname, p); (void) strcat(fullname, "/"); diff --git a/lib/libc/time/zdump.c b/lib/libc/time/zdump.c index 2df4b3e0930..bf71ad5809e 100644 --- a/lib/libc/time/zdump.c +++ b/lib/libc/time/zdump.c @@ -2,7 +2,7 @@ #if 0 static char elsieid[] = "@(#)zdump.c 7.24"; #else -static char rcsid[] = "$OpenBSD: zdump.c,v 1.4 1997/01/14 03:16:56 millert Exp $"; +static char rcsid[] = "$OpenBSD: zdump.c,v 1.5 1997/01/21 04:52:45 millert Exp $"; #endif #endif /* LIBC_SCCS and not lint */ @@ -224,7 +224,6 @@ _("%s: usage is %s [ -v ] [ -c cutoff ] zonename ...\n"), show(argv[i], t, TRUE); tm = *localtime(&t); (void) strncpy(buf, abbr(&tm), (sizeof buf) - 1); - buf[(sizeof buf) - 1] = '\0'; for ( ; ; ) { if (cutoff != NULL && t >= cuttime) break; @@ -241,7 +240,6 @@ _("%s: usage is %s [ -v ] [ -c cutoff ] zonename ...\n"), newtm = *localtime(&newt); (void) strncpy(buf, abbr(&newtm), (sizeof buf) - 1); - buf[(sizeof buf) - 1] = '\0'; } t = newt; tm = newtm;