]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/test/test-ipcrm.c
tree-wide: drop license boilerplate
[thirdparty/systemd.git] / src / test / test-ipcrm.c
1 /* SPDX-License-Identifier: LGPL-2.1+ */
2 /***
3 This file is part of systemd.
4
5 Copyright 2014 Lennart Poettering
6 ***/
7
8 #include "clean-ipc.h"
9 #include "user-util.h"
10 #include "util.h"
11
12 int main(int argc, char *argv[]) {
13 uid_t uid;
14 int r;
15 const char* name = argv[1] ?: NOBODY_USER_NAME;
16
17 r = get_user_creds(&name, &uid, NULL, NULL, NULL);
18 if (r < 0) {
19 log_full_errno(r == -ESRCH ? LOG_NOTICE : LOG_ERR,
20 r, "Failed to resolve \"%s\": %m", name);
21 return r == -ESRCH ? EXIT_TEST_SKIP : EXIT_FAILURE;
22 }
23
24 r = clean_ipc_by_uid(uid);
25 return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
26 }