14 char *dir = getenv("TMPDIR");
17 if (!s2) s2 = malloc(L_tmpnam);
21 /* this interface is insecure anyway but at least we can try.. */
22 if (!dir || strlen(dir) > L_tmpnam-32)
25 if (access(dir, R_OK|W_OK|X_OK) != 0)
29 for (index++; index < TMP_MAX; index++) {
30 snprintf(s, L_tmpnam, "%s/temp%d-%d", dir, pid, index);
31 if (access(s, F_OK) != 0) {