Upstream-Status: Denied [no desire for uclibc support] Signed-off-by: Khem Raj Index: systemd-204/src/journal/journal-send.c =================================================================== --- systemd-204.orig/src/journal/journal-send.c 2013-05-06 12:06:04.000000000 -0700 +++ systemd-204/src/journal/journal-send.c 2013-05-23 11:21:14.500338688 -0700 @@ -46,6 +46,8 @@ memcpy(*_f + 10, _func, _fl); \ } while(false) +#include "config.h" + /* We open a single fd, and we'll share it with the current process, * all its threads, and all its subprocesses. This means we need to * initialize it atomically, and need to operate on it atomically @@ -312,8 +314,13 @@ /* Message doesn't fit... Let's dump the data in a temporary * file and just pass a file descriptor of it to the other * side */ - +#ifdef HAVE_MKOSTEMP buffer_fd = mkostemp(path, O_CLOEXEC|O_RDWR); +#else + buffer_fd = mkstemp(path); + if (buffer_fd >= 0) fcntl(buffer_fd, F_SETFD, FD_CLOEXEC); +#endif /* HAVE_MKOSTEMP */ + if (buffer_fd < 0) return -errno; Index: systemd-204/src/core/manager.c =================================================================== --- systemd-204.orig/src/core/manager.c 2013-04-25 17:53:56.000000000 -0700 +++ systemd-204/src/core/manager.c 2013-05-23 11:23:15.864340878 -0700 @@ -72,6 +72,8 @@ #include "audit-fd.h" #include "env-util.h" +#include "config.h" + /* As soon as 16 units are in our GC queue, make sure to run a gc sweep */ #define GC_QUEUE_ENTRIES_MAX 16 @@ -1973,7 +1975,12 @@ return -ENOMEM; RUN_WITH_UMASK(0077) { +#ifdef HAVE_MKOSTEMP fd = mkostemp(path, O_RDWR|O_CLOEXEC); +#else + fd = mkstemp(path); + if (fd >= 0) fcntl(fd, F_SETFD, FD_CLOEXEC); +#endif /* HAVE_MKOSTEMP */ } if (fd < 0) { Index: systemd-204/src/shared/util.c =================================================================== --- systemd-204.orig/src/shared/util.c 2013-05-07 12:07:22.000000000 -0700 +++ systemd-204/src/shared/util.c 2013-05-23 11:19:35.028336822 -0700 @@ -74,6 +74,8 @@ #include "env-util.h" #include "fileio.h" +#include "config.h" + int saved_argc = 0; char **saved_argv = NULL; @@ -3921,7 +3923,12 @@ t[k] = '.'; stpcpy(stpcpy(t+k+1, fn), "XXXXXX"); +#ifdef HAVE_MKOSTEMP fd = mkostemp(t, O_WRONLY|O_CLOEXEC); +#else + fd = mkstemp(t); + if (fd >= 0) fcntl(fd, F_SETFD, FD_CLOEXEC); +#endif /* HAVE_MKOSTEMP */ if (fd < 0) { free(t); return -errno; Index: systemd-204/src/shared/ask-password-api.c =================================================================== --- systemd-204.orig/src/shared/ask-password-api.c 2013-04-08 08:26:34.000000000 -0700 +++ systemd-204/src/shared/ask-password-api.c 2013-05-23 11:24:43.456342451 -0700 @@ -37,6 +37,8 @@ #include "ask-password-api.h" +#include "config.h" + static void backspace_chars(int ttyfd, size_t p) { if (ttyfd < 0) @@ -325,7 +327,12 @@ mkdir_p_label("/run/systemd/ask-password", 0755); RUN_WITH_UMASK(0022) { +#ifdef HAVE_MKOSTEMP fd = mkostemp(temp, O_CLOEXEC|O_CREAT|O_WRONLY); +#else + fd = mkstemp(temp); + if (fd >= 0) fcntl(fd, F_SETFD, FD_CLOEXEC); +#endif /* HAVE_MKOSTEMP */ } if (fd < 0) { Index: systemd-204/src/journal/journalctl.c =================================================================== --- systemd-204.orig/src/journal/journalctl.c 2013-05-07 12:07:22.000000000 -0700 +++ systemd-204/src/journal/journalctl.c 2013-05-23 11:19:35.028336822 -0700 @@ -755,7 +755,13 @@ n /= arg_interval; close_nointr_nofail(fd); +#ifdef HAVE_MKOSTEMP fd = mkostemp(k, O_WRONLY|O_CLOEXEC|O_NOCTTY); +#else + fd = mkstemp(k); + if (fd >= 0) fcntl(fd, F_SETFD, FD_CLOEXEC); +#endif /* HAVE_MKOSTEMP */ + if (fd < 0) { log_error("Failed to open %s: %m", k); r = -errno; Index: systemd-204/src/journal/journal-verify.c =================================================================== --- systemd-204.orig/src/journal/journal-verify.c 2012-11-20 13:42:23.000000000 -0800 +++ systemd-204/src/journal/journal-verify.c 2013-05-23 11:19:35.032336822 -0700 @@ -700,8 +700,12 @@ #endif } else if (f->seal) return -ENOKEY; - +#ifdef HAVE_MKOSTEMP data_fd = mkostemp(data_path, O_CLOEXEC); +#else + data_fd = mkstemp(data_path); + if (data_fd >= 0) fcntl(data_fd, F_SETFD, FD_CLOEXEC); +#endif /* HAVE_MKOSTEMP */ if (data_fd < 0) { log_error("Failed to create data file: %m"); r = -errno; @@ -709,7 +713,12 @@ } unlink(data_path); +#ifdef HAVE_MKOSTEMP entry_fd = mkostemp(entry_path, O_CLOEXEC); +#else + entry_fd = mkstemp(entry_path); + if (entry_fd >= 0) fcntl(entry_fd, F_SETFD, FD_CLOEXEC); +#endif /* HAVE_MKOSTEMP */ if (entry_fd < 0) { log_error("Failed to create entry file: %m"); r = -errno; @@ -717,7 +726,12 @@ } unlink(entry_path); +#ifdef HAVE_MKOSTEMP entry_array_fd = mkostemp(entry_array_path, O_CLOEXEC); +#else + entry_array_fd = mkstemp(entry_array_path); + if (entry_array_fd >= 0) fcntl(entry_array_fd, F_SETFD, FD_CLOEXEC); +#endif /* HAVE_MKOSTEMP */ if (entry_array_fd < 0) { log_error("Failed to create entry array file: %m"); r = -errno;