OpenSDE Packages Database (without history before r20070)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

56 lines
1.7 KiB

  1. # --- SDE-COPYRIGHT-NOTE-BEGIN ---
  2. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  3. #
  4. # Filename: package/.../dietlibc/putenv.patch
  5. # Copyright (C) 2006 The T2 SDE Project
  6. #
  7. # More information can be found in the files COPYING and README.
  8. #
  9. # This patch file is dual-licensed. It is available under the license the
  10. # patched project is licensed under, as long as it is an OpenSource license
  11. # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
  12. # of the GNU General Public License as published by the Free Software
  13. # Foundation; either version 2 of the License, or (at your option) any later
  14. # version.
  15. # --- SDE-COPYRIGHT-NOTE-END ---
  16. For clearenv().
  17. - Rene Rebe <rene@exactcode.de>
  18. --- ./lib/putenv.c 19 Feb 2006 15:38:28 -0000 1.9
  19. +++ ./lib/putenv.c 22 Jun 2006 14:13:24 -0000
  20. @@ -2,6 +2,8 @@
  21. #include <string.h>
  22. #include <errno.h>
  23. +char **__origenv; /* also used by clearenv */
  24. +
  25. int putenv(const char *string) {
  26. size_t len;
  27. int envc;
  28. @@ -9,8 +11,7 @@
  29. char *tmp;
  30. const char **ep;
  31. char **newenv;
  32. - static char **origenv;
  33. - if (!origenv) origenv=environ;
  34. + if (!__origenv) __origenv=environ;
  35. if (!(tmp=strchr(string,'='))) {
  36. len=strlen(string);
  37. remove=1;
  38. @@ -29,11 +30,11 @@
  39. ++envc;
  40. }
  41. if (tmp) {
  42. - newenv = (char**) realloc(environ==origenv?0:environ,
  43. + newenv = (char**) realloc(environ==__origenv?0:environ,
  44. (envc+2)*sizeof(char*));
  45. if (!newenv) return -1;
  46. - if (envc && (environ==origenv)) {
  47. - memcpy(newenv,origenv,envc*sizeof(char*));
  48. + if (envc && (environ==__origenv)) {
  49. + memcpy(newenv,__origenv,envc*sizeof(char*));
  50. }
  51. newenv[envc]=(char*)string;
  52. newenv[envc+1]=0;