www.delorie.com/djgpp/bugs/show.cgi   search  
Bug 000048

When Created: 01/09/1996 02:16:39
Against DJGPP version: 2.00.beta3
By whom: eliz@is.elta.co.il
Abstract: `putenv' library function doesn't work in dumped Emacs (in beta4)
`putenv' caches the maximum number of environment variables seen so far,
which causes a bug in dumped Emacs.

Solution added: 01/09/1996 02:17:57
By whom: eliz@is.elta.co.il
*** src/libc/compat/stdlib/putenv.c~0   Sun Oct  1 04:41:00 1995
--- src/libc/compat/stdlib/putenv.c     Mon Jan  8 17:35:30 1996
***************
*** 2,7 ****
--- 2,8 ----
  #include <libc/stubs.h>
  #include <stdlib.h>
  #include <string.h>
+ #include <libc/bss.h>

  /*

***************
*** 14,19 ****
--- 15,21 ----
  extern char **environ;
  static int ecount = -1;
  static int emax = -1;
+ static int putenv_bss_count = -1;

  int
  putenv(const char *val)
***************
*** 26,33 ****
    if (epos == 0)
      return -1;

!   if (ecount == -1)
    {
      for (ecount=0; environ[ecount]; ecount++);
      emax = ecount;
    }
--- 28,36 ----
    if (epos == 0)
      return -1;

!   if (putenv_bss_count != __bss_count)
    {
+     putenv_bss_count = __bss_count;
      for (ecount=0; environ[ecount]; ecount++);
      emax = ecount;
    }

Note added: 01/09/1996 11:10:02
By whom: terra@diku.dk
With that code it should be possible to delete the initializations
of emax and ecount.

Fixed in version 2.00.beta5 on 01/23/1996 21:59:12
By whom: dj@delorie.com



  webmaster   donations   bookstore     delorie software   privacy  
  Copyright 2010   by DJ Delorie     Updated Jul 2010