Loading...
gen/confstr.c Libc-583 Libc-498
--- Libc/Libc-583/gen/confstr.c
+++ Libc/Libc-498/gen/confstr.c
@@ -62,7 +62,6 @@
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
-#include <stdio.h>	/* for P_tmpdir */
 
 #include <dirhelper_priv.h>
 
@@ -107,7 +106,7 @@
 			buf[len - 1] = '\0';
 			free(p);
 		}
-		return (tlen);
+		return (tlen + 1);
 
 	case _CS_POSIX_V6_ILP32_OFF32_CFLAGS:
 	case _CS_XBS5_ILP32_OFF32_CFLAGS:		/* legacy */
@@ -181,17 +180,8 @@
 			errno = ENOMEM;
 			return (CONFSTR_ERR_RET);
 		}
-		if (_dirhelper(DIRHELPER_USER_LOCAL_TEMP, p, PATH_MAX) == NULL) {
-			/*
-			 * If _dirhelper() fails, try TMPDIR and P_tmpdir,
-			 * finally failing otherwise.
-			 */
-			if ((p = getenv("TMPDIR")) && access(p, W_OK) == 0)
-				goto docopy;
-			if (access(p = P_tmpdir, W_OK) == 0)
-				goto docopy;
-			return (CONFSTR_ERR_RET);
-		}
+		if (_dirhelper(DIRHELPER_USER_LOCAL_TEMP, p, PATH_MAX) == NULL)
+			return (CONFSTR_ERR_RET);
 		goto docopy;
 
 	case _CS_DARWIN_USER_CACHE_DIR: