From ff2041c955e9152bd286ab6ea534b8445caab574 Mon Sep 17 00:00:00 2001 From: James Peach Date: Tue, 27 Jun 2006 05:49:09 +0000 Subject: r16556: Add mkdtemp to libreplace. This is apparantly available on Linux and BSD systems, but it's not everywhere. (This used to be commit b3d2512ed4fc8c378607bcc2dc241a1f77ab7197) --- source4/lib/replace/replace.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'source4/lib/replace/replace.c') diff --git a/source4/lib/replace/replace.c b/source4/lib/replace/replace.c index 02c3d04163..989c0947c3 100644 --- a/source4/lib/replace/replace.c +++ b/source4/lib/replace/replace.c @@ -506,6 +506,21 @@ int rep_mkstemp(char *template) } #endif +#ifndef HAVE_MKDTEMP +char * mkdtemp(char *template) +{ + char *dname; + + if (dname = mktemp(template)) { + if (mkdir(dname, 0700) >= 0) { + return dname; + } + } + + return NULL; +} +#endif + #ifndef HAVE_PREAD static ssize_t pread(int __fd, void *__buf, size_t __nbytes, off_t __offset) { -- cgit