diff options
author | Evgeny Vereshchagin <evvers@ya.ru> | 2017-01-31 19:04:20 +0300 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2017-01-31 11:04:20 -0500 |
commit | d3cba4eaf618ced1935a96e721b2fbcbad7694bb (patch) | |
tree | e2aeff17619a4357278a97ece4cf6994e4867f92 /src/coredump | |
parent | aa475dc227e0f7334d5b662755d48a7d03656f43 (diff) |
coredump: really extract container cmdline (#5167)
Fixes:
```
root# systemd-nspawn -D ./cont/ --register=no /bin/sh -c '/bin/sh -c "kill -ABRT \$\$"'
...
Container cont failed with error code 134.
root# journalctl MESSAGE_ID=fc2e22bc6ee647b6b90729ab34a250b1 -o verbose | grep -i container_cmdline
...prints nothing...
...should be COREDUMP_CONTAINER_CMDLINE=systemd-nspawn -D ./cont/ --register=no /bin/sh -c /bin/sh -c "kill -ABRT \$\$"
```
Also, fixes CID #1368263
```
==352== 130 bytes in 1 blocks are definitely lost in loss record 1 of 2
==352== at 0x4C2ED5F: realloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==352== by 0x4ED8581: greedy_realloc (alloc-util.c:57)
==352== by 0x4ECAAD5: get_process_cmdline (process-util.c:147)
==352== by 0x10E385: get_process_container_parent_cmdline (coredump.c:645)
==352== by 0x112949: process_kernel (coredump.c:1240)
==352== by 0x113003: main (coredump.c:1297)
==352==
```
Diffstat (limited to 'src/coredump')
-rw-r--r-- | src/coredump/coredump.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/coredump/coredump.c b/src/coredump/coredump.c index d55d896df4..1f6fb5de1e 100644 --- a/src/coredump/coredump.c +++ b/src/coredump/coredump.c @@ -642,7 +642,11 @@ static int get_process_container_parent_cmdline(pid_t pid, char** cmdline) { if (r < 0) return r; - return get_process_cmdline(container_pid, 0, false, cmdline); + r = get_process_cmdline(container_pid, 0, false, cmdline); + if (r < 0) + return r; + + return 1; } static int change_uid_gid(const char *context[]) { |