]>
Commit | Line | Data |
---|---|---|
db9ecf05 | 1 | /* SPDX-License-Identifier: LGPL-2.1-or-later */ |
66cdd0f2 | 2 | |
66cdd0f2 | 3 | #include "clean-ipc.h" |
bb4febf4 ZJS |
4 | #include "errno-util.h" |
5 | #include "main-func.h" | |
317bb217 | 6 | #include "tests.h" |
bb4febf4 | 7 | #include "user-util.h" |
66cdd0f2 | 8 | |
bb4febf4 | 9 | static int run(int argc, char *argv[]) { |
66cdd0f2 | 10 | uid_t uid; |
c1ab8191 | 11 | int r; |
cda3d0c2 | 12 | const char* name = argv[1] ?: NOBODY_USER_NAME; |
c1ab8191 | 13 | |
6d7c4033 ZJS |
14 | test_setup_logging(LOG_INFO); |
15 | ||
fafff8f1 | 16 | r = get_user_creds(&name, &uid, NULL, NULL, NULL, 0); |
317bb217 ZJS |
17 | if (r == -ESRCH) |
18 | return log_tests_skipped("Failed to resolve user"); | |
bb4febf4 ZJS |
19 | if (r < 0) |
20 | return log_error_errno(r, "Failed to resolve \"%s\": %m", name); | |
66cdd0f2 | 21 | |
5c7119f4 | 22 | r = clean_ipc_by_uid(uid); |
bb4febf4 ZJS |
23 | if (ERRNO_IS_PRIVILEGE(r)) |
24 | return log_tests_skipped("No privileges"); | |
25 | ||
26 | return r; | |
66cdd0f2 | 27 | } |
bb4febf4 ZJS |
28 | |
29 | DEFINE_MAIN_FUNCTION_WITH_POSITIVE_FAILURE(run); |