diff options
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.patch | 166 |
1 files changed, 166 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..8de9a3a326 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/systemd-pam-fix-mkostemp.patch | |||
@@ -0,0 +1,166 @@ | |||
1 | Index: git/src/journal/journal-send.c | ||
2 | =================================================================== | ||
3 | --- git.orig/src/journal/journal-send.c 2012-09-02 00:10:08.748768268 -0700 | ||
4 | +++ git/src/journal/journal-send.c 2012-09-02 00:10:10.508768335 -0700 | ||
5 | @@ -34,6 +34,8 @@ | ||
6 | |||
7 | #define SNDBUF_SIZE (8*1024*1024) | ||
8 | |||
9 | +#include "config.h" | ||
10 | + | ||
11 | /* We open a single fd, and we'll share it with the current process, | ||
12 | * all its threads, and all its subprocesses. This means we need to | ||
13 | * initialize it atomically, and need to operate on it atomically | ||
14 | @@ -293,7 +295,12 @@ | ||
15 | * file and just pass a file descriptor of it to the other | ||
16 | * side */ | ||
17 | |||
18 | +#ifdef HAVE_MKOSTEMP | ||
19 | buffer_fd = mkostemp(path, O_CLOEXEC|O_RDWR); | ||
20 | +#else | ||
21 | + buffer_fd = mkstemp(path); | ||
22 | + if (buffer_fd >= 0) fcntl(buffer_fd, F_SETFD, FD_CLOEXEC); | ||
23 | +#endif /* HAVE_MKOSTEMP */ | ||
24 | if (buffer_fd < 0) { | ||
25 | r = -errno; | ||
26 | goto finish; | ||
27 | Index: git/src/core/manager.c | ||
28 | =================================================================== | ||
29 | --- git.orig/src/core/manager.c 2012-09-02 00:10:08.732768266 -0700 | ||
30 | +++ git/src/core/manager.c 2012-09-02 00:10:10.512768334 -0700 | ||
31 | @@ -67,6 +67,8 @@ | ||
32 | #include "cgroup-util.h" | ||
33 | #include "path-util.h" | ||
34 | |||
35 | +#include "config.h" | ||
36 | + | ||
37 | /* As soon as 16 units are in our GC queue, make sure to run a gc sweep */ | ||
38 | #define GC_QUEUE_ENTRIES_MAX 16 | ||
39 | |||
40 | @@ -1701,7 +1703,12 @@ | ||
41 | return -ENOMEM; | ||
42 | |||
43 | saved_umask = umask(0077); | ||
44 | +#ifdef HAVE_MKOSTEMP | ||
45 | fd = mkostemp(path, O_RDWR|O_CLOEXEC); | ||
46 | +#else | ||
47 | + fd = mkstemp(path); | ||
48 | + if (fd >= 0) fcntl(fd, F_SETFD, FD_CLOEXEC); | ||
49 | +#endif /* HAVE_MKOSTEMP */ | ||
50 | umask(saved_umask); | ||
51 | |||
52 | if (fd < 0) { | ||
53 | Index: git/src/shared/util.c | ||
54 | =================================================================== | ||
55 | --- git.orig/src/shared/util.c 2012-09-02 00:10:08.784768269 -0700 | ||
56 | +++ git/src/shared/util.c 2012-09-02 00:10:10.512768334 -0700 | ||
57 | @@ -68,6 +68,8 @@ | ||
58 | #include "exit-status.h" | ||
59 | #include "hashmap.h" | ||
60 | |||
61 | +#include "config.h" | ||
62 | + | ||
63 | int saved_argc = 0; | ||
64 | char **saved_argv = NULL; | ||
65 | |||
66 | @@ -4519,7 +4521,12 @@ | ||
67 | t[k] = '.'; | ||
68 | stpcpy(stpcpy(t+k+1, fn), "XXXXXX"); | ||
69 | |||
70 | +#ifdef HAVE_MKOSTEMP | ||
71 | fd = mkostemp(t, O_WRONLY|O_CLOEXEC); | ||
72 | +#else | ||
73 | + fd = mkstemp(t); | ||
74 | + if (fd >= 0) fcntl(fd, F_SETFD, FD_CLOEXEC); | ||
75 | +#endif /* HAVE_MKOSTEMP */ | ||
76 | if (fd < 0) { | ||
77 | free(t); | ||
78 | return -errno; | ||
79 | Index: git/src/shared/ask-password-api.c | ||
80 | =================================================================== | ||
81 | --- git.orig/src/shared/ask-password-api.c 2012-09-02 00:10:08.772768268 -0700 | ||
82 | +++ git/src/shared/ask-password-api.c 2012-09-02 00:10:10.512768334 -0700 | ||
83 | @@ -37,6 +37,8 @@ | ||
84 | |||
85 | #include "ask-password-api.h" | ||
86 | |||
87 | +#include "config.h" | ||
88 | + | ||
89 | static void backspace_chars(int ttyfd, size_t p) { | ||
90 | |||
91 | if (ttyfd < 0) | ||
92 | @@ -326,7 +328,12 @@ | ||
93 | mkdir_p_label("/run/systemd/ask-password", 0755); | ||
94 | |||
95 | u = umask(0022); | ||
96 | +#ifdef HAVE_MKOSTEMP | ||
97 | fd = mkostemp(temp, O_CLOEXEC|O_CREAT|O_WRONLY); | ||
98 | +#else | ||
99 | + fd = mkstemp(temp); | ||
100 | + if (fd >= 0) fcntl(fd, F_SETFD, FD_CLOEXEC); | ||
101 | +#endif /* HAVE_MKOSTEMP */ | ||
102 | umask(u); | ||
103 | |||
104 | if (fd < 0) { | ||
105 | Index: git/src/journal/journalctl.c | ||
106 | =================================================================== | ||
107 | --- git.orig/src/journal/journalctl.c 2012-09-02 00:10:08.752768267 -0700 | ||
108 | +++ git/src/journal/journalctl.c 2012-09-02 00:18:41.928787779 -0700 | ||
109 | @@ -540,7 +540,13 @@ | ||
110 | n /= arg_interval; | ||
111 | |||
112 | close_nointr_nofail(fd); | ||
113 | +#ifdef HAVE_MKOSTEMP | ||
114 | fd = mkostemp(k, O_WRONLY|O_CLOEXEC|O_NOCTTY); | ||
115 | +#else | ||
116 | + fd = mkstemp(k); | ||
117 | + if (fd >= 0) fcntl(fd, F_SETFD, FD_CLOEXEC); | ||
118 | +#endif /* HAVE_MKOSTEMP */ | ||
119 | + | ||
120 | if (fd < 0) { | ||
121 | log_error("Failed to open %s: %m", k); | ||
122 | r = -errno; | ||
123 | Index: git/src/journal/journal-verify.c | ||
124 | =================================================================== | ||
125 | --- git.orig/src/journal/journal-verify.c 2012-09-02 00:10:08.752768267 -0700 | ||
126 | +++ git/src/journal/journal-verify.c 2012-09-02 00:24:10.268800268 -0700 | ||
127 | @@ -693,8 +693,12 @@ | ||
128 | #endif | ||
129 | } else if (f->seal) | ||
130 | return -ENOKEY; | ||
131 | - | ||
132 | +#ifdef HAVE_MKOSTEMP | ||
133 | data_fd = mkostemp(data_path, O_CLOEXEC); | ||
134 | +#else | ||
135 | + data_fd = mkstemp(data_path); | ||
136 | + if (data_fd >= 0) fcntl(data_fd, F_SETFD, FD_CLOEXEC); | ||
137 | +#endif /* HAVE_MKOSTEMP */ | ||
138 | if (data_fd < 0) { | ||
139 | log_error("Failed to create data file: %m"); | ||
140 | r = -errno; | ||
141 | @@ -702,7 +706,12 @@ | ||
142 | } | ||
143 | unlink(data_path); | ||
144 | |||
145 | +#ifdef HAVE_MKOSTEMP | ||
146 | entry_fd = mkostemp(entry_path, O_CLOEXEC); | ||
147 | +#else | ||
148 | + entry_fd = mkstemp(entry_path); | ||
149 | + if (entry_fd >= 0) fcntl(entry_fd, F_SETFD, FD_CLOEXEC); | ||
150 | +#endif /* HAVE_MKOSTEMP */ | ||
151 | if (entry_fd < 0) { | ||
152 | log_error("Failed to create entry file: %m"); | ||
153 | r = -errno; | ||
154 | @@ -710,7 +719,12 @@ | ||
155 | } | ||
156 | unlink(entry_path); | ||
157 | |||
158 | +#ifdef HAVE_MKOSTEMP | ||
159 | entry_array_fd = mkostemp(entry_array_path, O_CLOEXEC); | ||
160 | +#else | ||
161 | + entry_array_fd = mkstemp(entry_array_path); | ||
162 | + if (entry_array_fd >= 0) fcntl(entry_array_fd, F_SETFD, FD_CLOEXEC); | ||
163 | +#endif /* HAVE_MKOSTEMP */ | ||
164 | if (entry_array_fd < 0) { | ||
165 | log_error("Failed to create entry array file: %m"); | ||
166 | r = -errno; | ||