summaryrefslogtreecommitdiff
path: root/libexec/rexecd/rexecd.c
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 /libexec/rexecd/rexecd.c
parentb74ef7bac5077f29fc1c12e8b5ccaf0e2f1f8fdc (diff)
check return value for setenv(3) for failure, and deal appropriately
Diffstat (limited to 'libexec/rexecd/rexecd.c')
-rw-r--r--libexec/rexecd/rexecd.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/libexec/rexecd/rexecd.c b/libexec/rexecd/rexecd.c
index a22d773aecc..1cebbf62545 100644
--- a/libexec/rexecd/rexecd.c
+++ b/libexec/rexecd/rexecd.c
@@ -39,7 +39,7 @@ char copyright[] =
#ifndef lint
/*static char sccsid[] = "from: @(#)rexecd.c 5.12 (Berkeley) 2/25/91";*/
-static char rcsid[] = "$Id: rexecd.c,v 1.13 2000/08/20 18:42:38 millert Exp $";
+static char rcsid[] = "$Id: rexecd.c,v 1.14 2000/09/15 07:13:46 deraadt Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -260,10 +260,11 @@ doit(f, fromp)
(void) close(f);
environ = envinit;
- setenv("HOME", pwd->pw_dir, 1);
- setenv("SHELL", pwd->pw_shell, 1);
- setenv("LOGNAME", pwd->pw_name, 1);
- setenv("USER", pwd->pw_name, 1);
+ if (setenv("HOME", pwd->pw_dir, 1) == -1 ||
+ setenv("SHELL", pwd->pw_shell, 1) == -1 ||
+ setenv("LOGNAME", pwd->pw_name, 1) == -1 ||
+ setenv("USER", pwd->pw_name, 1) == -1)
+ err(1, "unable to setup environment");
if (setusercontext(lc, pwd, pwd->pw_uid, LOGIN_SETALL))
err(1, "unable to set user context");