]> git.saurik.com Git - apple/libc.git/blobdiff - stdio/FreeBSD/tmpfile.c
Libc-1439.100.3.tar.gz
[apple/libc.git] / stdio / FreeBSD / tmpfile.c
index cf5b70a12cc91dbbd1fdc67ce86e8fa23b4d9c47..1efbca7cf5b926b47512fa9417ccc0f41e9727d0 100644 (file)
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *     This product includes software developed by the University of
- *     California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
  *
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
  *
@@ -38,7 +34,7 @@
 static char sccsid[] = "@(#)tmpfile.c  8.1 (Berkeley) 6/4/93";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
 static char sccsid[] = "@(#)tmpfile.c  8.1 (Berkeley) 6/4/93";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdio/tmpfile.c,v 1.9 2003/02/06 01:08:19 mtm Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/stdio/tmpfile.c,v 1.10 2007/01/09 00:28:07 imp Exp $");
 
 #include "namespace.h"
 #include <sys/types.h>
 
 #include "namespace.h"
 #include <sys/types.h>
@@ -52,7 +48,7 @@ __FBSDID("$FreeBSD: src/lib/libc/stdio/tmpfile.c,v 1.9 2003/02/06 01:08:19 mtm E
 #include "un-namespace.h"
 
 FILE *
 #include "un-namespace.h"
 
 FILE *
-tmpfile()
+tmpfile(void)
 {
        sigset_t set, oset;
        FILE *fp;
 {
        sigset_t set, oset;
        FILE *fp;
@@ -67,6 +63,9 @@ tmpfile()
        if (tmpdir == NULL)
                tmpdir = _PATH_TMP;
 
        if (tmpdir == NULL)
                tmpdir = _PATH_TMP;
 
+       if (*tmpdir == '\0')
+               return (NULL);
+
        (void)asprintf(&buf, "%s%s%s", tmpdir,
            (tmpdir[strlen(tmpdir) - 1] == '/') ? "" : "/", TRAILER);
        if (buf == NULL)
        (void)asprintf(&buf, "%s%s%s", tmpdir,
            (tmpdir[strlen(tmpdir) - 1] == '/') ? "" : "/", TRAILER);
        if (buf == NULL)