diff options
author | Rob Landley <rob@landley.net> | 2019-05-03 11:45:43 -0500 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2019-05-03 11:45:43 -0500 |
commit | 121322285aa143a748fb7c725a5e2559a038eefd (patch) | |
tree | 9f9d777553da48b3c45a25054f6997b1f92c635a | |
parent | bd7c5c0555477d562bc7a4dab9561017a47b615e (diff) | |
download | toybox-121322285aa143a748fb7c725a5e2559a038eefd.tar.gz |
Add a couple comments.
-rw-r--r-- | lib/env.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -36,6 +36,7 @@ void xsetenv(char *name, char *val) // If we haven't snapshot initial environment state yet, do so now. if (!toys.envc) { + // envc is size +1 so even if env empty it's nonzero after initialization while (environ[toys.envc++]); memcpy(new = xmalloc(((toys.envc|0xff)+1)*sizeof(char *)), environ, toys.envc*sizeof(char *)); @@ -52,7 +53,7 @@ void xsetenv(char *name, char *val) if (val) new = xmprintf("%s=%s", name, val); } - envc = toys.envc-1; + envc = toys.envc-1; // compensate for size +1 above for (i = 0; environ[i]; i++) { // Drop old entry, freeing as appropriate. Assumes no duplicates. if (!memcmp(name, environ[i], len) && environ[i][len]=='=') { |