summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-04-29 21:40:54 +0200
committerSven Eden <yamakuzure@gmx.net>2017-03-14 08:19:28 +0100
commit011da473952eb8c7be67e8238f381fc87d50eb58 (patch)
tree86cdd1f544155ced166877b0fa054404a61a88b3 /src/test
parentdb9d657feb727d338d64b9a51cb25de6f20eeae4 (diff)
sd-bus: properly handle creds that are known but undefined for a process
A number of fields do not apply to all processes, including: there a processes without a controlling tty, without parent process, without service, user services or session. To distuingish these cases from the case where we simply don't have the data, always return ENXIO for them, while returning ENODATA for the case where we really lack the information. Also update the credentials dumping code to show this properly. Fields that are known but do not apply are now shown as "n/a". Note that this also changes some of the calls in process-util.c and cgroup-util.c to return ENXIO for these cases.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/test-process-util.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/test/test-process-util.c b/src/test/test-process-util.c
index 1de100cda..e4e2efecd 100644
--- a/src/test/test-process-util.c
+++ b/src/test/test-process-util.c
@@ -44,9 +44,8 @@ static void test_get_process_comm(void) {
if (stat("/proc/1/comm", &st) == 0) {
assert_se(get_process_comm(1, &a) >= 0);
log_info("pid1 comm: '%s'", a);
- } else {
+ } else
log_warning("/proc/1/comm does not exist.");
- }
assert_se(get_process_cmdline(1, 0, true, &c) >= 0);
log_info("pid1 cmdline: '%s'", c);
@@ -87,7 +86,7 @@ static void test_get_process_comm(void) {
log_info("self strlen(environ): '%zu'", strlen(env));
if (!detect_container(NULL))
- assert_se(get_ctty_devnr(1, &h) == -ENOENT);
+ assert_se(get_ctty_devnr(1, &h) == -ENXIO);
getenv_for_pid(1, "PATH", &i);
log_info("pid1 $PATH: '%s'", strna(i));