From 2242855594e38a84ec5ce76134c4bc8c164cdf32 Mon Sep 17 00:00:00 2001 From: Peter Seiderer Date: Sun, 25 Jan 2015 14:00:27 -0500 Subject: src/shared/util.{c,h}: fix build when mkostemp is not supported Not all instance of mkostemp were protected with #ifndef HAVE_DECL_MKOSTEMP. We fix this for the definition of the wrapper mkostemp_safe() in the c file and in the header. Signed-off-by: Peter Seiderer Signed-off-by: Anthony G. Basile --- src/shared/util.c | 4 +++- src/shared/util.h | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/shared/util.c b/src/shared/util.c index 6ef53b05ef..2dbcf9446c 100644 --- a/src/shared/util.c +++ b/src/shared/util.c @@ -1558,6 +1558,7 @@ int getpeercred(int fd, struct ucred *ucred) { return 0; } +#if HAVE_DECL_MKOSTEMP /* This is much like like mkostemp() but is subject to umask(). */ int mkostemp_safe(char *pattern, int flags) { _cleanup_umask_ mode_t u; @@ -1573,7 +1574,7 @@ int mkostemp_safe(char *pattern, int flags) { return fd; } - +#else /* This is much like like mkstemp() but is subject to umask(). */ int mkstemp_safe(char *pattern) { _cleanup_umask_ mode_t u; @@ -1589,6 +1590,7 @@ int mkstemp_safe(char *pattern) { return fd; } +#endif int tempfn_xxxxxx(const char *p, char **ret) { const char *fn; diff --git a/src/shared/util.h b/src/shared/util.h index bce4f0fa77..3f3d879a13 100644 --- a/src/shared/util.h +++ b/src/shared/util.h @@ -451,8 +451,11 @@ static inline void qsort_safe(void *base, size_t nmemb, size_t size, int proc_cmdline(char **ret); int getpeercred(int fd, struct ucred *ucred); +#if HAVE_DECL_MKOSTEMP int mkostemp_safe(char *pattern, int flags); +#else int mkstemp_safe(char *pattern); +#endif union file_handle_union { struct file_handle handle; -- cgit v1.2.3-54-g00ecf