X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Fenv%2Fputenv.c;h=d141db138893c55f3c13575f794817d75b001b7f;hb=4d07e5521ea811278f00f434fe2b8345ea1d8832;hp=181a41810bc2e4b39a3aefbae4300ffc0c3bd685;hpb=0b44a0315b47dd8eced9f3b7f31580cf14bbfc01;p=musl diff --git a/src/env/putenv.c b/src/env/putenv.c index 181a4181..d141db13 100644 --- a/src/env/putenv.c +++ b/src/env/putenv.c @@ -9,14 +9,14 @@ char **__env_map; int __putenv(char *s, int a) { int i=0, j=0; - char *end = strchr(s, '='); - size_t l = end-s+1; + char *z = strchr(s, '='); char **newenv = 0; char **newmap = 0; static char **oldenv; - - if (!end || l == 1) return -1; - for (; __environ[i] && memcmp(s, __environ[i], l); i++); + + if (!z) return unsetenv(s); + if (z==s) return -1; + for (; __environ[i] && memcmp(s, __environ[i], z-s+1); i++); if (a) { if (!__env_map) { __env_map = calloc(2, sizeof(char *));