summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/systemd/systemd/systemd-pam-fix-mkostemp.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-core/systemd/systemd/systemd-pam-fix-mkostemp.patch')
-rw-r--r--meta/recipes-core/systemd/systemd/systemd-pam-fix-mkostemp.patch170
1 files changed, 170 insertions, 0 deletions
diff --git a/meta/recipes-core/systemd/systemd/systemd-pam-fix-mkostemp.patch b/meta/recipes-core/systemd/systemd/systemd-pam-fix-mkostemp.patch
new file mode 100644
index 0000000000..99ea5736bc
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/systemd-pam-fix-mkostemp.patch
@@ -0,0 +1,170 @@
1Upstream-Status: Denied [no desire for uclibc support]
2Signed-off-by: Khem Raj <raj.khem@gmail.com>
3
4Index: systemd-206/src/journal/journal-send.c
5===================================================================
6--- systemd-206.orig/src/journal/journal-send.c 2013-07-21 15:43:28.000000000 -0700
7+++ systemd-206/src/journal/journal-send.c 2013-08-21 08:50:50.825892498 -0700
8@@ -46,6 +46,8 @@
9 memcpy(*_f + 10, _func, _fl); \
10 } while(false)
11
12+#include "config.h"
13+
14 /* We open a single fd, and we'll share it with the current process,
15 * all its threads, and all its subprocesses. This means we need to
16 * initialize it atomically, and need to operate on it atomically
17@@ -311,8 +313,13 @@
18 /* Message doesn't fit... Let's dump the data in a temporary
19 * file and just pass a file descriptor of it to the other
20 * side */
21-
22+#ifdef HAVE_MKOSTEMP
23 buffer_fd = mkostemp(path, O_CLOEXEC|O_RDWR);
24+#else
25+ buffer_fd = mkstemp(path);
26+ if (buffer_fd >= 0) fcntl(buffer_fd, F_SETFD, FD_CLOEXEC);
27+#endif /* HAVE_MKOSTEMP */
28+
29 if (buffer_fd < 0)
30 return -errno;
31
32Index: systemd-206/src/core/manager.c
33===================================================================
34--- systemd-206.orig/src/core/manager.c 2013-07-21 15:43:28.000000000 -0700
35+++ systemd-206/src/core/manager.c 2013-08-21 08:51:35.209893331 -0700
36@@ -71,6 +71,7 @@
37 #include "audit-fd.h"
38 #include "efivars.h"
39 #include "env-util.h"
40+#include "config.h"
41
42 /* As soon as 5s passed since a unit was added to our GC queue, make sure to run a gc sweep */
43 #define GC_QUEUE_USEC_MAX (10*USEC_PER_SEC)
44@@ -2058,7 +2059,12 @@
45 return -ENOMEM;
46
47 RUN_WITH_UMASK(0077) {
48+#ifdef HAVE_MKOSTEMP
49 fd = mkostemp(path, O_RDWR|O_CLOEXEC);
50+#else
51+ fd = mkstemp(path);
52+ if (fd >= 0) fcntl(fd, F_SETFD, FD_CLOEXEC);
53+#endif /* HAVE_MKOSTEMP */
54 }
55
56 if (fd < 0) {
57Index: systemd-206/src/shared/util.c
58===================================================================
59--- systemd-206.orig/src/shared/util.c 2013-07-21 15:43:28.000000000 -0700
60+++ systemd-206/src/shared/util.c 2013-08-21 08:50:50.829892498 -0700
61@@ -74,6 +74,8 @@
62 #include "env-util.h"
63 #include "fileio.h"
64
65+#include "config.h"
66+
67 int saved_argc = 0;
68 char **saved_argv = NULL;
69
70@@ -3980,7 +3982,12 @@
71 t[k] = '.';
72 stpcpy(stpcpy(t+k+1, fn), "XXXXXX");
73
74+#ifdef HAVE_MKOSTEMP
75 fd = mkostemp(t, O_WRONLY|O_CLOEXEC);
76+#else
77+ fd = mkstemp(t);
78+ if (fd >= 0) fcntl(fd, F_SETFD, FD_CLOEXEC);
79+#endif /* HAVE_MKOSTEMP */
80 if (fd < 0) {
81 free(t);
82 return -errno;
83Index: systemd-206/src/shared/ask-password-api.c
84===================================================================
85--- systemd-206.orig/src/shared/ask-password-api.c 2013-07-21 15:43:28.000000000 -0700
86+++ systemd-206/src/shared/ask-password-api.c 2013-08-21 08:50:50.829892498 -0700
87@@ -37,6 +37,8 @@
88
89 #include "ask-password-api.h"
90
91+#include "config.h"
92+
93 static void backspace_chars(int ttyfd, size_t p) {
94
95 if (ttyfd < 0)
96@@ -325,7 +327,12 @@
97 mkdir_p_label("/run/systemd/ask-password", 0755);
98
99 RUN_WITH_UMASK(0022) {
100+#ifdef HAVE_MKOSTEMP
101 fd = mkostemp(temp, O_CLOEXEC|O_CREAT|O_WRONLY);
102+#else
103+ fd = mkstemp(temp);
104+ if (fd >= 0) fcntl(fd, F_SETFD, FD_CLOEXEC);
105+#endif /* HAVE_MKOSTEMP */
106 }
107
108 if (fd < 0) {
109Index: systemd-206/src/journal/journalctl.c
110===================================================================
111--- systemd-206.orig/src/journal/journalctl.c 2013-07-21 15:43:28.000000000 -0700
112+++ systemd-206/src/journal/journalctl.c 2013-08-21 08:50:50.833892498 -0700
113@@ -1005,7 +1005,13 @@
114 n /= arg_interval;
115
116 close_nointr_nofail(fd);
117+#ifdef HAVE_MKOSTEMP
118 fd = mkostemp(k, O_WRONLY|O_CLOEXEC|O_NOCTTY);
119+#else
120+ fd = mkstemp(k);
121+ if (fd >= 0) fcntl(fd, F_SETFD, FD_CLOEXEC);
122+#endif /* HAVE_MKOSTEMP */
123+
124 if (fd < 0) {
125 log_error("Failed to open %s: %m", k);
126 r = -errno;
127Index: systemd-206/src/journal/journal-verify.c
128===================================================================
129--- systemd-206.orig/src/journal/journal-verify.c 2013-07-21 15:43:28.000000000 -0700
130+++ systemd-206/src/journal/journal-verify.c 2013-08-21 08:50:50.833892498 -0700
131@@ -811,8 +811,12 @@
132 #endif
133 } else if (f->seal)
134 return -ENOKEY;
135-
136+#ifdef HAVE_MKOSTEMP
137 data_fd = mkostemp(data_path, O_CLOEXEC);
138+#else
139+ data_fd = mkstemp(data_path);
140+ if (data_fd >= 0) fcntl(data_fd, F_SETFD, FD_CLOEXEC);
141+#endif /* HAVE_MKOSTEMP */
142 if (data_fd < 0) {
143 log_error("Failed to create data file: %m");
144 r = -errno;
145@@ -820,7 +824,12 @@
146 }
147 unlink(data_path);
148
149+#ifdef HAVE_MKOSTEMP
150 entry_fd = mkostemp(entry_path, O_CLOEXEC);
151+#else
152+ entry_fd = mkstemp(entry_path);
153+ if (entry_fd >= 0) fcntl(entry_fd, F_SETFD, FD_CLOEXEC);
154+#endif /* HAVE_MKOSTEMP */
155 if (entry_fd < 0) {
156 log_error("Failed to create entry file: %m");
157 r = -errno;
158@@ -828,7 +837,12 @@
159 }
160 unlink(entry_path);
161
162+#ifdef HAVE_MKOSTEMP
163 entry_array_fd = mkostemp(entry_array_path, O_CLOEXEC);
164+#else
165+ entry_array_fd = mkstemp(entry_array_path);
166+ if (entry_array_fd >= 0) fcntl(entry_array_fd, F_SETFD, FD_CLOEXEC);
167+#endif /* HAVE_MKOSTEMP */
168 if (entry_array_fd < 0) {
169 log_error("Failed to create entry array file: %m");
170 r = -errno;