projects
/
platform
/
upstream
/
systemd.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
b8d0ffc
)
util: when we try to read /proc/cmdline in a container, read /proc/1/cmdline instead
author
Lennart Poettering
<lennart@poettering.net>
Mon, 23 Dec 2013 17:10:57 +0000
(18:10 +0100)
committer
Lennart Poettering
<lennart@poettering.net>
Mon, 23 Dec 2013 17:13:12 +0000
(18:13 +0100)
src/shared/util.c
patch
|
blob
|
history
diff --git
a/src/shared/util.c
b/src/shared/util.c
index
5c9d0bb
..
8d7cf53
100644
(file)
--- a/
src/shared/util.c
+++ b/
src/shared/util.c
@@
-5994,8
+5994,20
@@
int proc_cmdline(char **ret) {
int r;
if (detect_container(NULL) > 0) {
- *ret = NULL;
- return 0;
+ char *buf, *p;
+ size_t sz = 0;
+
+ r = read_full_file("/proc/1/cmdline", &buf, &sz);
+ if (r < 0)
+ return r;
+
+ for (p = buf; p + 1 < buf + sz; p++)
+ if (*p == 0)
+ *p = ' ';
+
+ *p = 0;
+ *ret = buf;
+ return 1;
}
r = read_one_line_file("/proc/cmdline", ret);