[hackers] [sbase] env: Check unsetenv() return value || sin

From: <git_AT_suckless.org>
Date: Fri, 6 Nov 2015 11:52:53 +0100 (CET)

commit b553349251e3904601f4c535e2f5b0911450da88
Author: sin <sin_AT_2f30.org>
AuthorDate: Fri Nov 6 10:51:04 2015 +0000
Commit: sin <sin_AT_2f30.org>
CommitDate: Fri Nov 6 10:52:49 2015 +0000

    env: Check unsetenv() return value
    
    ./env -u "" foo and ./env -u "A=123" foo should both fail.

diff --git a/env.c b/env.c
index 4da2630..5d7e8a5 100644
--- a/env.c
+++ b/env.c
_AT_@ -25,7 +25,8 @@ main(int argc, char *argv[])
                 *environ = NULL;
                 break;
         case 'u':
- unsetenv(EARGF(usage()));
+ if (unsetenv(EARGF(usage())) < 0)
+ eprintf("unsetenv:");
                 break;
         default:
                 usage();
Received on Fri Nov 06 2015 - 11:52:53 CET

This archive was generated by hypermail 2.3.0 : Fri Nov 06 2015 - 12:00:21 CET