X-Git-Url: https://git.saurik.com/apple/libc.git/blobdiff_plain/7b00c0c43f52e9d27168e67a26aac19065cdb40c..ad3c9f2af814c84582fdd1649e49ec4f68572c5a:/stdlib/FreeBSD/putenv.c.patch diff --git a/stdlib/FreeBSD/putenv.c.patch b/stdlib/FreeBSD/putenv.c.patch deleted file mode 100644 index 47a412e..0000000 --- a/stdlib/FreeBSD/putenv.c.patch +++ /dev/null @@ -1,94 +0,0 @@ ---- putenv.c.orig 2011-04-12 22:08:20.000000000 -0700 -+++ putenv.c 2011-04-13 14:33:50.000000000 -0700 -@@ -35,22 +35,81 @@ __FBSDID("$FreeBSD: src/lib/libc/stdlib/ - - #include - #include -+#include -+#include -+#include -+#include -+#include -+ -+extern malloc_zone_t *__zone0; -+#ifdef LEGACY_CRT1_ENVIRON -+extern char **_saved_environ; -+#endif /* LEGACY_CRT1_ENVIRON */ -+ -+extern void __malloc_check_env_name(const char *); -+__private_extern__ int __setenv(const char *, const char *, int, int, char ***, malloc_zone_t *); -+ -+#ifndef BUILDING_VARIANT -+/* -+ * _putenvp -- SPI using an arbitrary pointer to string array (the array must -+ * have been created with malloc) and an env state, created by _allocenvstate(). -+ * Returns ptr to value associated with name, if any, else NULL. -+ */ -+int -+_putenvp(char *str, char ***envp, void *state) -+{ -+ /* insure __zone0 is set up */ -+ if (!__zone0) { -+ __zone0 = malloc_create_zone(0, 0); -+ if (!__zone0) { -+ errno = ENOMEM; -+ return (-1); -+ } -+ } -+ return (__setenv(str, NULL, 1, 0, envp, (state ? (malloc_zone_t *)state : __zone0))); -+} -+#endif /* BUILDING_VARIANT */ - - int - putenv(str) -- const char *str; -+ char *str; - { -- char *p, *equal; -- int rval; -+#ifdef LEGACY_CRT1_ENVIRON -+ int ret; -+#endif /* LEGACY_CRT1_ENVIRON */ - -- if ((p = strdup(str)) == NULL) -+#if __DARWIN_UNIX03 -+ if (str == NULL || *str == 0 || index(str, '=') == NULL) { -+ errno = EINVAL; - return (-1); -- if ((equal = index(p, '=')) == NULL) { -- (void)free(p); -+ } -+#else /* !__DARWIN_UNIX03 */ -+ if (index(str, '=') == NULL) - return (-1); -+#endif /* __DARWIN_UNIX03 */ -+ /* insure __zone0 is set up before calling __malloc_check_env_name */ -+ if (!__zone0) { -+ __zone0 = malloc_create_zone(0, 0); -+ if (!__zone0) { -+ errno = ENOMEM; -+ return (-1); -+ } - } -- *equal = '\0'; -- rval = setenv(p, equal + 1, 1); -- (void)free(p); -- return (rval); -+ __malloc_check_env_name(str); /* see if we are changing a malloc environment variable */ -+#ifdef LEGACY_CRT1_ENVIRON -+ ret = -+#else /* !LEGACY_CRT1_ENVIRON */ -+ return -+#endif /* !LEGACY_CRT1_ENVIRON */ -+ __setenv(str, NULL, 1, -+#if __DARWIN_UNIX03 -+ 0, -+#else /* !__DARWIN_UNIX03 */ -+ -1, -+#endif /* __DARWIN_UNIX03 */ -+ _NSGetEnviron(), __zone0); -+#ifdef LEGACY_CRT1_ENVIRON -+ _saved_environ = *_NSGetEnviron(); -+ return ret; -+#endif /* LEGACY_CRT1_ENVIRON */ - }