--------------------- PatchSet 7077 Date: 2005/10/08 07:47:27 Author: serassio Branch: nt-2_5 Tag: (none) Log: setenv() is not available on MinGW Members: include/util.h:1.10.14.9->1.10.14.10 lib/win32lib.c:1.1.32.19->1.1.32.20 Index: squid/include/util.h =================================================================== RCS file: /cvsroot/squid-sf//squid/include/util.h,v retrieving revision 1.10.14.9 retrieving revision 1.10.14.10 diff -u -r1.10.14.9 -r1.10.14.10 --- squid/include/util.h 2 Oct 2005 14:15:28 -0000 1.10.14.9 +++ squid/include/util.h 8 Oct 2005 07:47:27 -0000 1.10.14.10 @@ -1,5 +1,5 @@ /* - * $Id: util.h,v 1.10.14.9 2005/10/02 14:15:28 serassio Exp $ + * $Id: util.h,v 1.10.14.10 2005/10/08 07:47:27 serassio Exp $ * * AUTHOR: Harvest Derived * @@ -138,7 +138,6 @@ #ifdef _SQUID_MSWIN_ #if defined(_MSC_VER) /* Microsoft C Compiler ONLY */ extern int64_t WIN32_strtoll(const char *nptr, char **endptr, int base); -extern int setenv(const char *, const char *, int); #endif extern int chroot (const char *); extern int ftruncate(int, off_t); @@ -155,6 +154,7 @@ extern int seteuid(uid_t); extern gid_t getgid(void); extern gid_t getegid(void); +extern int setenv(const char *, const char *, int); extern int setgid(gid_t); extern int setegid(gid_t); extern const char *WIN32_strerror(int); Index: squid/lib/win32lib.c =================================================================== RCS file: /cvsroot/squid-sf//squid/lib/win32lib.c,v retrieving revision 1.1.32.19 retrieving revision 1.1.32.20 diff -u -r1.1.32.19 -r1.1.32.20 --- squid/lib/win32lib.c 2 Oct 2005 14:15:28 -0000 1.1.32.19 +++ squid/lib/win32lib.c 8 Oct 2005 07:47:27 -0000 1.1.32.20 @@ -1,5 +1,5 @@ /* - * $Id: win32lib.c,v 1.1.32.19 2005/10/02 14:15:28 serassio Exp $ + * $Id: win32lib.c,v 1.1.32.20 2005/10/08 07:47:27 serassio Exp $ * * * * * * * * * Legal stuff * * * * * * * * @@ -96,27 +96,6 @@ return 4096; } -int setenv(const char *name, const char *value, int overwrite) -{ - char *buf; - int ret; - int len = strlen(name) + strlen(value) + 2; - - if (!overwrite) { - if (getenv(name)) - return (0); - } - - buf = xmalloc(len); - if (!buf) - return (-1); - - snprintf(buf, len, "%s=%s", name, value); - ret = putenv(buf); - xfree(buf); - return (ret); -} - int64_t WIN32_strtoll(const char *nptr, char **endptr, int base) { const char *s; @@ -203,6 +182,27 @@ } #endif +int setenv(const char *name, const char *value, int overwrite) +{ + char *buf; + int ret; + int len = strlen(name) + strlen(value) + 2; + + if (!overwrite) { + if (getenv(name)) + return (0); + } + + buf = xmalloc(len); + if (!buf) + return (-1); + + snprintf(buf, len, "%s=%s", name, value); + ret = putenv(buf); + xfree(buf); + return (ret); +} + uid_t geteuid(void) { return 100;