summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: cfa5b2b)
raw | patch | inline | side by side (parent: cfa5b2b)
author | Shawn O. Pearce <spearce@spearce.org> | |
Sat, 20 Oct 2007 20:03:49 +0000 (16:03 -0400) | ||
committer | Shawn O. Pearce <spearce@spearce.org> | |
Sun, 21 Oct 2007 02:52:21 +0000 (22:52 -0400) |
Solaris 9 doesn't have mkdtemp() so we need to emulate it for the
rsync transport implementation. Since Solaris 9 is lacking this
function we can also reasonably assume it is not available on
Solaris 8 either. The new Makfile definition NO_MKDTEMP can be
set to enable the git compat version.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
rsync transport implementation. Since Solaris 9 is lacking this
function we can also reasonably assume it is not available on
Solaris 8 either. The new Makfile definition NO_MKDTEMP can be
set to enable the git compat version.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Makefile | patch | blob | history | |
compat/mkdtemp.c | [new file with mode: 0644] | patch | blob |
git-compat-util.h | patch | blob | history |
diff --git a/Makefile b/Makefile
index bb4873d75431f5b86ab2ce807d7f7d6a54c71faa..6287418df3d326f029341fd1055db420ffd90a0d 100644 (file)
--- a/Makefile
+++ b/Makefile
#
# Define NO_SETENV if you don't have setenv in the C library.
#
+# Define NO_MKDTEMP if you don't have mkdtemp in the C library.
+#
# Define NO_SYMLINK_HEAD if you never want .git/HEAD to be a symbolic link.
# Enable it on Windows. By default, symrefs are still used.
#
NEEDS_LIBICONV = YesPlease
NO_UNSETENV = YesPlease
NO_SETENV = YesPlease
+ NO_MKDTEMP = YesPlease
NO_C99_FORMAT = YesPlease
NO_STRTOUMAX = YesPlease
endif
ifeq ($(uname_R),5.9)
NO_UNSETENV = YesPlease
NO_SETENV = YesPlease
+ NO_MKDTEMP = YesPlease
NO_C99_FORMAT = YesPlease
NO_STRTOUMAX = YesPlease
endif
COMPAT_CFLAGS += -DNO_SETENV
COMPAT_OBJS += compat/setenv.o
endif
+ifdef NO_MKDTEMP
+ COMPAT_CFLAGS += -DNO_MKDTEMP
+ COMPAT_OBJS += compat/mkdtemp.o
+endif
ifdef NO_UNSETENV
COMPAT_CFLAGS += -DNO_UNSETENV
COMPAT_OBJS += compat/unsetenv.o
diff --git a/compat/mkdtemp.c b/compat/mkdtemp.c
--- /dev/null
+++ b/compat/mkdtemp.c
@@ -0,0 +1,8 @@
+#include "../git-compat-util.h"
+
+char *gitmkdtemp(char *template)
+{
+ if (!mktemp(template) || mkdir(template, 0700))
+ return NULL;
+ return template;
+}
diff --git a/git-compat-util.h b/git-compat-util.h
index f23d934f667cc2b10ee668a3bfef8492aadbbe7d..474f1d1ffbee5433ec311174ee37804ab16417bb 100644 (file)
--- a/git-compat-util.h
+++ b/git-compat-util.h
extern int gitsetenv(const char *, const char *, int);
#endif
+#ifdef NO_MKDTEMP
+#define mkdtemp gitmkdtemp
+extern char *gitmkdtemp(char *);
+#endif
+
#ifdef NO_UNSETENV
#define unsetenv gitunsetenv
extern void gitunsetenv(const char *);