Index: git/src/journal/journal-send.c
===================================================================
--- git.orig/src/journal/journal-send.c	2012-09-02 00:10:08.748768268 -0700
+++ git/src/journal/journal-send.c	2012-09-02 00:10:10.508768335 -0700
@@ -34,6 +34,8 @@
 
 #define SNDBUF_SIZE (8*1024*1024)
 
+#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
@@ -293,7 +295,12 @@
          * 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) {
                 r = -errno;
                 goto finish;
Index: git/src/core/manager.c
===================================================================
--- git.orig/src/core/manager.c	2012-09-02 00:10:08.732768266 -0700
+++ git/src/core/manager.c	2012-09-02 00:10:10.512768334 -0700
@@ -67,6 +67,8 @@
 #include "cgroup-util.h"
 #include "path-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
 
@@ -1701,7 +1703,12 @@
                 return -ENOMEM;
 
         saved_umask = 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 */
         umask(saved_umask);
 
         if (fd < 0) {
Index: git/src/shared/util.c
===================================================================
--- git.orig/src/shared/util.c	2012-09-02 00:10:08.784768269 -0700
+++ git/src/shared/util.c	2012-09-02 00:10:10.512768334 -0700
@@ -68,6 +68,8 @@
 #include "exit-status.h"
 #include "hashmap.h"
 
+#include "config.h"
+
 int saved_argc = 0;
 char **saved_argv = NULL;
 
@@ -4519,7 +4521,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: git/src/shared/ask-password-api.c
===================================================================
--- git.orig/src/shared/ask-password-api.c	2012-09-02 00:10:08.772768268 -0700
+++ git/src/shared/ask-password-api.c	2012-09-02 00:10:10.512768334 -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)
@@ -326,7 +328,12 @@
         mkdir_p_label("/run/systemd/ask-password", 0755);
 
         u = 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 */
         umask(u);
 
         if (fd < 0) {
Index: git/src/journal/journalctl.c
===================================================================
--- git.orig/src/journal/journalctl.c	2012-09-02 00:10:08.752768267 -0700
+++ git/src/journal/journalctl.c	2012-09-02 00:18:41.928787779 -0700
@@ -540,7 +540,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: git/src/journal/journal-verify.c
===================================================================
--- git.orig/src/journal/journal-verify.c	2012-09-02 00:10:08.752768267 -0700
+++ git/src/journal/journal-verify.c	2012-09-02 00:24:10.268800268 -0700
@@ -693,8 +693,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;
@@ -702,7 +706,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;
@@ -710,7 +719,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;
