aboutsummaryrefslogtreecommitdiff
path: root/winsup/cygwin/environ.cc
diff options
context:
space:
mode:
authorKen Brown <kbrown@cornell.edu>2018-06-06 11:45:57 -0400
committerCorinna Vinschen <corinna@vinschen.de>2018-06-07 09:42:36 +0200
commit3a049236dbb426f63b6182253c04fb9811848dc5 (patch)
tree1caae878c377f0e5b0d9418ca4b2d3103bf49726 /winsup/cygwin/environ.cc
parentdefaa2ca31cd3e407451d55ea8414f30d7dddf65 (diff)
downloadnewlib-3a049236dbb426f63b6182253c04fb9811848dc5.zip
newlib-3a049236dbb426f63b6182253c04fb9811848dc5.tar.gz
newlib-3a049236dbb426f63b6182253c04fb9811848dc5.tar.bz2
Cygwin: Remove workaround in environ.cc
Commit ebd645e on 2001-10-03 made environ.cc:_addenv() add unneeded space at the end of the environment block to "work around problems with some buggy applications." This clutters the code and is presumably no longer needed.
Diffstat (limited to 'winsup/cygwin/environ.cc')
-rw-r--r--winsup/cygwin/environ.cc10
1 files changed, 4 insertions, 6 deletions
diff --git a/winsup/cygwin/environ.cc b/winsup/cygwin/environ.cc
index bbe5398..67ead1d 100644
--- a/winsup/cygwin/environ.cc
+++ b/winsup/cygwin/environ.cc
@@ -592,13 +592,11 @@ _addenv (const char *name, const char *value, int overwrite)
{ /* Create new slot. */
int sz = envsize (cur_environ ());
- /* If sz == 0, we need two new slots, one for the terminating NULL.
- But we add two slots in all cases, as has been done since
- 2001-10-03 (commit ebd645e) to "work around problems with
- some buggy applications." */
- int allocsz = (sz + 2) * sizeof (char *);
+ /* If sz == 0, we need two new slots, one for the terminating NULL. */
+ int newsz = sz == 0 ? 2 : sz + 1;
+ int allocsz = newsz * sizeof (char *);
- offset = sz == 0 ? 0 : sz - 1;
+ offset = newsz - 2;
/* Allocate space for additional element. */
if (cur_environ () == lastenviron)