aboutsummaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/systemd/systemd/systemd-pam-fix-mkostemp.patch
blob: be4d3e39d934469a73e5e0277509e6f656ea6a53 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.khem@gmail.com>

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;