Module Name: src
Committed By: tron
Date: Sun Sep 7 13:35:27 UTC 2014
Modified Files:
src/external/bsd/cron/dist: env.c
Log Message:
Make crontab(1) work again which got broken by the last commit.
To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/bsd/cron/dist/env.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/external/bsd/cron/dist/env.c
diff -u src/external/bsd/cron/dist/env.c:1.3 src/external/bsd/cron/dist/env.c:1.4
--- src/external/bsd/cron/dist/env.c:1.3 Fri Sep 5 21:32:37 2014
+++ src/external/bsd/cron/dist/env.c Sun Sep 7 13:35:27 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: env.c,v 1.3 2014/09/05 21:32:37 christos Exp $ */
+/* $NetBSD: env.c,v 1.4 2014/09/07 13:35:27 tron Exp $ */
/* Copyright 1988,1990,1993,1994 by Paul Vixie
* All rights reserved
@@ -25,7 +25,7 @@
#if 0
static char rcsid[] = "Id: env.c,v 1.10 2004/01/23 18:56:42 vixie Exp";
#else
-__RCSID("$NetBSD: env.c,v 1.3 2014/09/05 21:32:37 christos Exp $");
+__RCSID("$NetBSD: env.c,v 1.4 2014/09/07 13:35:27 tron Exp $");
#endif
#endif
@@ -58,9 +58,9 @@ env_copy(char **envp) {
for (count = 0; envp[count] != NULL; count++)
continue;
p = malloc((count + 1) * sizeof(*p)); /* 1 for the NULL */
- if (p != NULL)
- return NULL;
- for (i = 0; i < count; i++)
+ if (p == NULL)
+ return NULL;
+ for (i = 0; i < count; i++) {
if ((p[i] = strdup(envp[i])) == NULL) {
save_errno = errno;
for (count = 0; count < i; count++)
@@ -69,6 +69,7 @@ env_copy(char **envp) {
errno = save_errno;
return NULL;
}
+ }
p[count] = NULL;
return p;
}