summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEvgeny Vereshchagin <evvers@ya.ru>2016-11-20 19:38:58 +0300
committerGitHub <noreply@github.com>2016-11-20 19:38:58 +0300
commit270f419316758162bfead87608cbaeeb4fd6987e (patch)
tree47b8efe91c3326345d861f888ad59a38a44d502e /src
parent3f59367e6fae0ba991d1e287a0f784ecdcda79af (diff)
parentcf5f9bb8402906d37cdd55e8b06da9c7b5ac06a5 (diff)
Merge pull request #4691 from keszybz/test-suite-fixes
Test suite fixes
Diffstat (limited to 'src')
-rw-r--r--src/basic/process-util.c2
-rw-r--r--src/test/test-ipcrm.c8
-rw-r--r--src/test/test-process-util.c9
3 files changed, 14 insertions, 5 deletions
diff --git a/src/basic/process-util.c b/src/basic/process-util.c
index 48a5c719af..1f4c2e4e43 100644
--- a/src/basic/process-util.c
+++ b/src/basic/process-util.c
@@ -675,7 +675,7 @@ int getenv_for_pid(pid_t pid, const char *field, char **_value) {
}
line[i] = 0;
- if (memcmp(line, field, l) == 0 && line[l] == '=') {
+ if (strneq(line, field, l) && line[l] == '=') {
value = strdup(line + l + 1);
if (!value)
return -ENOMEM;
diff --git a/src/test/test-ipcrm.c b/src/test/test-ipcrm.c
index 551eba7215..463e135e2b 100644
--- a/src/test/test-ipcrm.c
+++ b/src/test/test-ipcrm.c
@@ -28,9 +28,11 @@ int main(int argc, char *argv[]) {
r = get_user_creds(&name, &uid, NULL, NULL, NULL);
if (r < 0) {
- log_error_errno(r, "Failed to resolve \"%s\": %m", name);
- return EXIT_FAILURE;
+ log_full_errno(r == -ESRCH ? LOG_NOTICE : LOG_ERR,
+ r, "Failed to resolve \"%s\": %m", name);
+ return r == -ESRCH ? EXIT_TEST_SKIP : EXIT_FAILURE;
}
- return clean_ipc_by_uid(uid) < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
+ r = clean_ipc_by_uid(uid);
+ return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
}
diff --git a/src/test/test-process-util.c b/src/test/test-process-util.c
index 9ada46b1e9..7242b2c8b5 100644
--- a/src/test/test-process-util.c
+++ b/src/test/test-process-util.c
@@ -193,7 +193,14 @@ static void test_get_process_cmdline_harder(void) {
fd = mkostemp(path, O_CLOEXEC);
assert_se(fd >= 0);
- assert_se(mount(path, "/proc/self/cmdline", "bind", MS_BIND, NULL) >= 0);
+
+ if (mount(path, "/proc/self/cmdline", "bind", MS_BIND, NULL) < 0) {
+ /* This happens under selinux… Abort the test in this case. */
+ log_warning_errno(errno, "mount(..., \"/proc/self/cmdline\", \"bind\", ...) failed: %m");
+ assert(errno == EACCES);
+ return;
+ }
+
assert_se(unlink(path) >= 0);
assert_se(prctl(PR_SET_NAME, "testa") >= 0);