env: Check unsetenv() return value

./env -u "" foo and ./env -u "A=123" foo should both fail.
This commit is contained in:
sin 2015-11-06 10:51:04 +00:00
parent 1b32732887
commit b553349251

3
env.c
View File

@ -25,7 +25,8 @@ main(int argc, char *argv[])
*environ = NULL; *environ = NULL;
break; break;
case 'u': case 'u':
unsetenv(EARGF(usage())); if (unsetenv(EARGF(usage())) < 0)
eprintf("unsetenv:");
break; break;
default: default:
usage(); usage();