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