Fix some of the illegal symbols that are flagged. Also changed the
wrapper for unsetenv to return an int to match the glibc-2.2.2 and
later version. Tools build for FreeBSD appears to be using an older
libc so it always reports success in that case.
DIR *Posix_OpenDir(const char *pathName);
int Posix_System(const char *command);
int Posix_Putenv(char *name);
-void Posix_Unsetenv(const char *name);
+int Posix_Unsetenv(const char *name);
/*
* These functions return dynamically allocated stings that have to be
* POSIX unsetenv().
*
* Results:
- * None.
+ * 0 on success. -1 on error.
*
* Side effects:
* Environment may be changed.
*----------------------------------------------------------------------
*/
-void
+int
Posix_Unsetenv(const char *name) // IN:
{
char *rawName;
+ int ret;
if (!PosixConvertToCurrent(name, &rawName)) {
- return;
+ return -1;
}
#if defined(sun)
- putenv(rawName);
-#else
+ ret = putenv(rawName);
+#elif defined(__FreeBSD__)
+ /*
+ * Our tools build appears to use an old enough libc version that returns
+ * void.
+ */
unsetenv(rawName);
+ ret = 0;
+#else
+ ret = unsetenv(rawName);
#endif
Posix_Free(rawName);
+
+ return ret;
}