]> andersk Git - gssapi-openssh.git/blobdiff - openssh/openbsd-compat/mktemp.c
declare ssh_gssapi_krb5_updatecreds() before reference
[gssapi-openssh.git] / openssh / openbsd-compat / mktemp.c
index 2285c84dfd72751dfc4e9bf3fa94a9403bfa7ff8..9ed1bc80f4eae35d7f50066368d9d3b5a80dff77 100644 (file)
@@ -1,7 +1,6 @@
 /* THIS FILE HAS BEEN MODIFIED FROM THE ORIGINAL OPENBSD SOURCE */
 /* Changes: Removed mktemp */
 
-/*     $OpenBSD: mktemp.c,v 1.19 2005/08/08 08:05:36 espie Exp $ */
 /*
  * Copyright (c) 1987, 1993
  *     The Regents of the University of California.  All rights reserved.
  * 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. Neither the name of the University nor the names of its contributors
+ * 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
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
  *
  * SUCH DAMAGE.
  */
 
-/* OPENBSD ORIGINAL: lib/libc/stdio/mktemp.c */
-
 #include "includes.h"
 
-#include <sys/types.h>
-#include <sys/stat.h>
+#ifndef HAVE_MKDTEMP
 
-#include <fcntl.h>
-#include <ctype.h>
-#include <errno.h>
-#include <unistd.h>
+#if defined(LIBC_SCCS) && !defined(lint)
+static char rcsid[] = "$OpenBSD: mktemp.c,v 1.13 1998/06/30 23:03:13 deraadt Exp $";
+#endif /* LIBC_SCCS and not lint */
 
-#if !defined(HAVE_MKDTEMP) || defined(HAVE_STRICT_MKSTEMP)
+#ifdef HAVE_CYGWIN
+#define open binary_open
+extern int binary_open();
+#endif
 
 static int _gettemp(char *, int *, int, int);
 
 int
-mkstemps(char *path, int slen)
+mkstemps(path, slen)
+       char *path;
+       int slen;
 {
        int fd;
 
@@ -56,7 +60,8 @@ mkstemps(char *path, int slen)
 }
 
 int
-mkstemp(char *path)
+mkstemp(path)
+       char *path;
 {
        int fd;
 
@@ -64,7 +69,8 @@ mkstemp(char *path)
 }
 
 char *
-mkdtemp(char *path)
+mkdtemp(path)
+       char *path;
 {
        return(_gettemp(path, (int *)NULL, 1, 0) ? path : (char *)NULL);
 }
@@ -78,8 +84,7 @@ _gettemp(path, doopen, domkdir, slen)
 {
        register char *start, *trv, *suffp;
        struct stat sbuf;
-       int rval;
-       pid_t pid;
+       int pid, rval;
 
        if (doopen && domkdir) {
                errno = EINVAL;
@@ -96,11 +101,11 @@ _gettemp(path, doopen, domkdir, slen)
                return (0);
        }
        pid = getpid();
-       while (trv >= path && *trv == 'X' && pid != 0) {
+       while (*trv == 'X' && pid != 0) {
                *trv-- = (pid % 10) + '0';
                pid /= 10;
        }
-       while (trv >= path && *trv == 'X') {
+       while (*trv == 'X') {
                char c;
 
                pid = (arc4random() & 0xffff) % (26+26);
@@ -175,4 +180,4 @@ _gettemp(path, doopen, domkdir, slen)
        /*NOTREACHED*/
 }
 
-#endif /* !defined(HAVE_MKDTEMP) || defined(HAVE_STRICT_MKSTEMP) */
+#endif /* !HAVE_MKDTEMP */
This page took 0.037993 seconds and 4 git commands to generate.