From 987942a206ef0f2342bf81d5de6432c6af42b7e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Tue, 21 Nov 2023 09:56:26 +0100 Subject: New upstream version 4.17 --- src/tc-switchuser.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src/tc-switchuser.c') diff --git a/src/tc-switchuser.c b/src/tc-switchuser.c index 1763527..4cc5604 100644 --- a/src/tc-switchuser.c +++ b/src/tc-switchuser.c @@ -19,7 +19,7 @@ static const struct HXoption options_table[] = { HXOPT_TABLEEND, }; -int main(int argc, const char **argv) +static int runner(int argc, const char **argv) { HX_getopt(options_table, &argc, &argv, HXOPT_USAGEONERR); const char *user = user_name != NULL ? user_name : "-"; @@ -27,12 +27,12 @@ int main(int argc, const char **argv) switch (HXproc_switch_user(user_name, group_name)) { case HXPROC_USER_NOT_FOUND: if (user_name == NULL) - abort(); /* impossible outcomes */ + return EXIT_FAILURE; /* impossible outcomes */ printf("No such user \"%s\": %s\n", user_name, strerror(errno)); break; case HXPROC_GROUP_NOT_FOUND: if (group_name == NULL || *group_name == '\0') - abort(); /* impossible outcome */ + return EXIT_FAILURE; /* impossible outcome */ printf("No such group \"%s\": %s\n", group_name, strerror(errno)); break; case HXPROC_SETUID_FAILED: @@ -64,6 +64,14 @@ int main(int argc, const char **argv) } return EXIT_SUCCESS; } + +int main(int argc, const char **argv) +{ + int ret = runner(argc, argv); + if (ret != EXIT_SUCCESS) + fprintf(stderr, "FAILED\n"); + return ret; +} #else int main(void) { -- cgit v1.2.3