]> git.cameronkatri.com Git - mandoc.git/blobdiff - compat_mkdtemp.c
fix the section number in the <title> element for preformatted pages;
[mandoc.git] / compat_mkdtemp.c
index cc336e547908951bf14952bb6b1a92959666c9c7..296bfd42becfc9b5fa60b5bf61bdd6cb69ddcfcc 100644 (file)
@@ -1,12 +1,4 @@
-#include "config.h"
-
-#if HAVE_MKDTEMP
-
-int dummy;
-
-#else
-
-/*     $Id: compat_mkdtemp.c,v 1.1 2015/03/19 14:57:29 schwarze Exp $  */
+/* $Id: compat_mkdtemp.c,v 1.3 2020/06/15 01:37:15 schwarze Exp $ */
 /*
  * Copyright (c) 2015 Ingo Schwarze <schwarze@openbsd.org>
  *
@@ -25,6 +17,7 @@ int dummy;
  * The algorithm of this function is inspired by OpenBSD mkdtemp(3)
  * by Theo de Raadt and Todd Miller, but the code differs.
  */
+#include "config.h"
 
 #include <sys/stat.h>
 #include <errno.h>
@@ -45,17 +38,15 @@ mkdtemp(char *path)
        for (tries = INT_MAX; tries; tries--) {
                if (mktemp(path) == NULL) {
                        errno = EEXIST;
-                       return(NULL);
+                       return NULL;
                }
                if (mkdir(path, S_IRUSR | S_IWUSR | S_IXUSR) == 0)
-                       return(path);
+                       return path;
                if (errno != EEXIST)
-                       return(NULL);
+                       return NULL;
                for (cp = start; *cp != '\0'; cp++)
                        *cp = 'X';
        }
        errno = EEXIST;
-       return(NULL);
+       return NULL;
 }
-
-#endif