summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2000-09-15 07:13:52 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2000-09-15 07:13:52 +0000
commit42a3e69c05af72afbc1d37574fba7729b828289b (patch)
treebecf08be7a11e201542de4de93b8cd0f8650f9e1 /usr.sbin
parentb74ef7bac5077f29fc1c12e8b5ccaf0e2f1f8fdc (diff)
check return value for setenv(3) for failure, and deal appropriately
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/cron/cron.c7
-rw-r--r--usr.sbin/pppd/main.c10
2 files changed, 10 insertions, 7 deletions
diff --git a/usr.sbin/cron/cron.c b/usr.sbin/cron/cron.c
index 2302bde2a4c..19d7a9813af 100644
--- a/usr.sbin/cron/cron.c
+++ b/usr.sbin/cron/cron.c
@@ -16,7 +16,7 @@
*/
#if !defined(lint) && !defined(LINT)
-static char rcsid[] = "$Id: cron.c,v 1.7 2000/08/21 00:39:00 deraadt Exp $";
+static char rcsid[] = "$Id: cron.c,v 1.8 2000/09/15 07:13:50 deraadt Exp $";
#endif
@@ -84,7 +84,10 @@ main(argc, argv)
set_cron_cwd();
#if defined(POSIX)
- setenv("PATH", _PATH_DEFPATH, 1);
+ if (setenv("PATH", _PATH_DEFPATH, 1) == -1) {
+ log_it("CRON",getpid(),"DEATH","can't malloc");
+ exit(1);
+ }
#endif
/* if there are no debug flags turned on, fork as a daemon should.
diff --git a/usr.sbin/pppd/main.c b/usr.sbin/pppd/main.c
index f00e03fcfb9..323de618f0c 100644
--- a/usr.sbin/pppd/main.c
+++ b/usr.sbin/pppd/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.28 2000/02/12 09:46:59 deraadt Exp $ */
+/* $OpenBSD: main.c,v 1.29 2000/09/15 07:13:51 deraadt Exp $ */
/*
* main.c - Point-to-Point Protocol main module
@@ -23,7 +23,7 @@
#if 0
static char rcsid[] = "Id: main.c,v 1.49 1998/05/05 05:24:17 paulus Exp $";
#else
-static char rcsid[] = "$OpenBSD: main.c,v 1.28 2000/02/12 09:46:59 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: main.c,v 1.29 2000/09/15 07:13:51 deraadt Exp $";
#endif
#endif
@@ -1624,7 +1624,7 @@ script_setenv(var, value)
newstring = (char *) malloc(vl + strlen(value) + 2);
if (newstring == 0)
- return;
+ novm("script_setenv");
strcpy(newstring, var);
newstring[vl] = '=';
strcpy(newstring+vl+1, value);
@@ -1642,7 +1642,7 @@ script_setenv(var, value)
i = 0;
script_env = (char **) malloc(16 * sizeof(char *));
if (script_env == 0)
- return;
+ novm("script_setenv");
s_env_nalloc = 16;
}
@@ -1652,7 +1652,7 @@ script_setenv(var, value)
char **newenv = (char **) realloc((void *)script_env,
new_n * sizeof(char *));
if (newenv == 0)
- return;
+ novm("script_setenv");
script_env = newenv;
s_env_nalloc = new_n;
}