summaryrefslogtreecommitdiff
path: root/source4/lib/replace/replace.c
diff options
context:
space:
mode:
authorJames Peach <jpeach@samba.org>2006-06-27 05:49:09 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:09:34 -0500
commitff2041c955e9152bd286ab6ea534b8445caab574 (patch)
tree7169ccd956bdae0d8965761b772aaba7b78f7524 /source4/lib/replace/replace.c
parent1db2f0d3a19913a460bec9eb516b4d96e9a3e595 (diff)
downloadsamba-ff2041c955e9152bd286ab6ea534b8445caab574.tar.gz
samba-ff2041c955e9152bd286ab6ea534b8445caab574.tar.bz2
samba-ff2041c955e9152bd286ab6ea534b8445caab574.zip
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)
Diffstat (limited to 'source4/lib/replace/replace.c')
-rw-r--r--source4/lib/replace/replace.c15
1 files changed, 15 insertions, 0 deletions
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)
{