DragonFly submit List (threaded) for 2005-09
[
Date Prev][
Date Next]
[
Thread Prev][
Thread Next]
[
Date Index][
Thread Index]
[PATCH] setenv|putenv rc checking (lib)
Index: libutil/login_class.c
===================================================================
RCS file: /mnt/share/dragonfly-cvs/src/lib/libutil/login_class.c,v
retrieving revision 1.4
diff -u -r1.4 login_class.c
--- libutil/login_class.c 4 Mar 2005 04:31:11 -0000 1.4
+++ libutil/login_class.c 29 Sep 2005 01:22:16 -0000
@@ -31,6 +31,7 @@
#include <sys/resource.h>
#include <sys/rtprio.h>
+#include <err.h>
#include <errno.h>
#include <fcntl.h>
#include <paths.h>
@@ -210,10 +211,12 @@
char * np = substvar(var, pwd, hlen, pch, nlen);
if (np != NULL) {
- setenv(vars->var, np, vars->overwrite);
+ if (setenv(vars->var, np, vars->overwrite) == ENOMEM)
+ err(1, "setenv: cannot set %s=%s", vars->var, np);
free(np);
} else if (vars->def != NULL) {
- setenv(vars->var, vars->def, 0);
+ if (setenv(vars->var, vars->def, 0) == ENOMEM)
+ err(1, "setenv: cannot set %s=%s", vars->var, vars->def);
}
++vars;
}
@@ -234,7 +237,8 @@
*p++ = '\0';
if ((np = substvar(p, pwd, hlen, pch, nlen)) != NULL) {
- setenv(*set_env, np, 1);
+ if (setenv(*set_env, np, 1) == ENOMEM)
+ err(1, "setenv: cannot set %s=%s", *set_env, np);
free(np);
}
}
[
Date Prev][
Date Next]
[
Thread Prev][
Thread Next]
[
Date Index][
Thread Index]