Check that putenv succeeded, suggested by Jonas Holmberg.
authorMatt Kraai <kraai@debian.org>
Fri, 11 May 2001 15:16:28 +0000 (15:16 -0000)
committerMatt Kraai <kraai@debian.org>
Fri, 11 May 2001 15:16:28 +0000 (15:16 -0000)
coreutils/env.c
env.c

index aca7c3ae2f4f0ddb28153fcf8c9714da8bd5c9d0..626fc1952a6d976aad3b590086ed60942af294e4 100644 (file)
@@ -59,7 +59,8 @@ extern int env_main(int argc, char** argv)
                cleanenv[0] = NULL;
        }
        for (argv += optind; *argv && (p = strchr(*argv, '=')); ++argv)
-               putenv(*argv);
+               if (putenv(*argv) < 0)
+                       perror_msg_and_die("%s", *argv);
        if (*argv) {
                execvp(*argv, argv);
                perror_msg_and_die("%s", *argv);
diff --git a/env.c b/env.c
index aca7c3ae2f4f0ddb28153fcf8c9714da8bd5c9d0..626fc1952a6d976aad3b590086ed60942af294e4 100644 (file)
--- a/env.c
+++ b/env.c
@@ -59,7 +59,8 @@ extern int env_main(int argc, char** argv)
                cleanenv[0] = NULL;
        }
        for (argv += optind; *argv && (p = strchr(*argv, '=')); ++argv)
-               putenv(*argv);
+               if (putenv(*argv) < 0)
+                       perror_msg_and_die("%s", *argv);
        if (*argv) {
                execvp(*argv, argv);
                perror_msg_and_die("%s", *argv);