svn commit: samba r16556 - in
branches/SAMBA_4_0/source/lib/replace: .
jpeach at samba.org
jpeach at samba.org
Tue Jun 27 05:49:09 GMT 2006
Author: jpeach
Date: 2006-06-27 05:49:09 +0000 (Tue, 27 Jun 2006)
New Revision: 16556
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=16556
Log:
Add mkdtemp to libreplace. This is apparantly available on Linux
and BSD systems, but it's not everywhere.
Modified:
branches/SAMBA_4_0/source/lib/replace/README
branches/SAMBA_4_0/source/lib/replace/config.m4
branches/SAMBA_4_0/source/lib/replace/replace.c
branches/SAMBA_4_0/source/lib/replace/replace.h
Changeset:
Modified: branches/SAMBA_4_0/source/lib/replace/README
===================================================================
--- branches/SAMBA_4_0/source/lib/replace/README 2006-06-27 04:00:13 UTC (rev 16555)
+++ branches/SAMBA_4_0/source/lib/replace/README 2006-06-27 05:49:09 UTC (rev 16556)
@@ -45,6 +45,7 @@
bzero
strerror
errno
+mkdtemp
mkstemp (a secure one!)
pread
pwrite
@@ -75,4 +76,4 @@
memset (for bzero)
syslog (for vsyslog)
setnetgrent, getnetgrent, endnetgrent (for innetgr)
-mktemp (for mkstemp)
+mktemp (for mkstemp and mkdtemp)
Modified: branches/SAMBA_4_0/source/lib/replace/config.m4
===================================================================
--- branches/SAMBA_4_0/source/lib/replace/config.m4 2006-06-27 04:00:13 UTC (rev 16555)
+++ branches/SAMBA_4_0/source/lib/replace/config.m4 2006-06-27 05:49:09 UTC (rev 16556)
@@ -57,7 +57,7 @@
AC_CHECK_FUNCS(seteuid setresuid setegid setresgid chroot bzero strerror)
AC_CHECK_FUNCS(timegm setenv vsyslog setlinebuf mktime ftruncate chsize rename)
AC_CHECK_FUNCS(waitpid strnlen strlcpy strlcat innetgr initgroups memmove strdup)
-AC_CHECK_FUNCS(pread pwrite strndup strcasestr strtok_r)
+AC_CHECK_FUNCS(pread pwrite strndup strcasestr strtok_r mkdtemp)
AC_HAVE_DECL(setresuid, [#include <unistd.h>])
AC_HAVE_DECL(setresgid, [#include <unistd.h>])
AC_HAVE_DECL(errno, [#include <errno.h>])
Modified: branches/SAMBA_4_0/source/lib/replace/replace.c
===================================================================
--- branches/SAMBA_4_0/source/lib/replace/replace.c 2006-06-27 04:00:13 UTC (rev 16555)
+++ branches/SAMBA_4_0/source/lib/replace/replace.c 2006-06-27 05:49:09 UTC (rev 16556)
@@ -506,6 +506,21 @@
}
#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)
{
Modified: branches/SAMBA_4_0/source/lib/replace/replace.h
===================================================================
--- branches/SAMBA_4_0/source/lib/replace/replace.h 2006-06-27 04:00:13 UTC (rev 16555)
+++ branches/SAMBA_4_0/source/lib/replace/replace.h 2006-06-27 05:49:09 UTC (rev 16556)
@@ -173,6 +173,10 @@
int rep_mkstemp(char *temp);
#endif
+#ifndef HAVE_MKDTEMP
+char *mkdtemp(char *template);
+#endif
+
#ifdef HAVE_LIMITS_H
#include <limits.h>
#endif
More information about the samba-cvs
mailing list