From 442f64a83bd2c5da085bc6dc50533df2d483be3b Mon Sep 17 00:00:00 2001 From: Amar Tumballi Date: Thu, 16 Jun 2011 04:36:46 +0000 Subject: build: fixes to work on solaris Signed-off-by: Amar Tumballi Signed-off-by: Anand Avati BUG: 3002 (build issues on solaris) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=3002 --- contrib/apple/daemon.c | 5 +++-- libglusterfs/src/compat.c | 19 +++++++++++++++++++ libglusterfs/src/compat.h | 2 ++ 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/contrib/apple/daemon.c b/contrib/apple/daemon.c index 07dbbc400..060f6a430 100644 --- a/contrib/apple/daemon.c +++ b/contrib/apple/daemon.c @@ -39,7 +39,6 @@ #include #include -#include #include #include @@ -77,7 +76,9 @@ os_daemon_return(nochdir, noclose) if (!nochdir) (void)chdir("/"); - if (!noclose && (fd = open(_PATH_DEVNULL, O_RDWR, 0)) != -1) { + /* Was using '_PATH_DEVNULL' earlier. As it was not defined in solaris, + changed to hardcoded path (and removed '#include ' too) */ + if (!noclose && (fd = open("/dev/null", O_RDWR, 0)) != -1) { (void)dup2(fd, STDIN_FILENO); (void)dup2(fd, STDOUT_FILENO); (void)dup2(fd, STDERR_FILENO); diff --git a/libglusterfs/src/compat.c b/libglusterfs/src/compat.c index 42c20f527..72bd0d3e2 100644 --- a/libglusterfs/src/compat.c +++ b/libglusterfs/src/compat.c @@ -528,6 +528,25 @@ solaris_rename (const char *old_path, const char *new_path) return rename(old_path, new_path); } + +char * +mkdtemp (char *tempstring) +{ + char *new_string = NULL; + int ret = 0; + + new_string = mktemp (tempstring); + if (!new_string) + goto out; + + ret = mkdir (new_string, 0700); + if (ret < 0) + new_string = NULL; + +out: + return new_string; +} + #endif /* GF_SOLARIS_HOST_OS */ #ifndef HAVE_STRNLEN diff --git a/libglusterfs/src/compat.h b/libglusterfs/src/compat.h index 4d336ea06..34e72a8a1 100644 --- a/libglusterfs/src/compat.h +++ b/libglusterfs/src/compat.h @@ -284,6 +284,8 @@ int solaris_rename (const char *oldpath, const char *newpath); int solaris_unlink (const char *pathname); +char *mkdtemp (char *temp); + #define GF_SOLARIS_XATTR_DIR ".glusterfs_xattr_inode" int solaris_xattr_resolve_path (const char *real_path, char **path); -- cgit