Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2020-08-07 14:29:43 +0300
committerCorinna Vinschen <corinna@vinschen.de>2020-08-07 16:09:56 +0300
commite7fca6f867f441aaf54061545b297a62ce93708f (patch)
treeb36ba6baec69f39ef26d2ed8502fadca721d96fb /winsup/utils/setfacl.c
parent9beb7b977162bd576da325ce8e23152e70989f78 (diff)
Cygwin: utils: convert usage() to proper noreturn function throughout
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Diffstat (limited to 'winsup/utils/setfacl.c')
-rw-r--r--winsup/utils/setfacl.c44
1 files changed, 10 insertions, 34 deletions
diff --git a/winsup/utils/setfacl.c b/winsup/utils/setfacl.c
index 926581a39..eb4ad6c65 100644
--- a/winsup/utils/setfacl.c
+++ b/winsup/utils/setfacl.c
@@ -525,7 +525,7 @@ setfacl (action_t action, const char *path, aclent_t *acls, int cnt)
return 0;
}
-static void
+static void __attribute__ ((__noreturn__))
usage (FILE *stream)
{
fprintf (stream, ""
@@ -647,6 +647,7 @@ usage (FILE *stream)
}
else
fprintf(stream, "Try '%s --help' for more information.\n", prog_name);
+ exit (stream == stdout ? 0 : 1);
}
struct option longopts[] = {
@@ -702,10 +703,7 @@ main (int argc, char **argv)
else if (action == DeleteDef)
action = DeleteAll;
else
- {
- usage (stderr);
- return 1;
- }
+ usage (stderr);
break;
case 'd': /* Backward compat */
case 'x':
@@ -714,10 +712,7 @@ main (int argc, char **argv)
else if (action == Modify)
action = ModNDel;
else
- {
- usage (stderr);
- return 1;
- }
+ usage (stderr);
if (! getaclentries (Delete, optarg, acls, &aclidx))
{
fprintf (stderr, "%s: illegal acl entries\n", prog_name);
@@ -728,10 +723,7 @@ main (int argc, char **argv)
if (action == NoAction)
action = Set;
else
- {
- usage (stderr);
- return 1;
- }
+ usage (stderr);
if (! getaclentries (SetFromFile, optarg, acls, &aclidx))
{
fprintf (stderr, "%s: illegal acl entries\n", prog_name);
@@ -740,17 +732,13 @@ main (int argc, char **argv)
break;
case 'h':
usage (stdout);
- return 0;
case 'k':
if (action == NoAction)
action = DeleteDef;
else if (action == DeleteExt)
action = DeleteAll;
else
- {
- usage (stderr);
- return 1;
- }
+ usage (stderr);
break;
case 'm':
if (action == NoAction)
@@ -758,10 +746,7 @@ main (int argc, char **argv)
else if (action == Delete)
action = ModNDel;
else
- {
- usage (stderr);
- return 1;
- }
+ usage (stderr);
if (! getaclentries (Modify, optarg, acls, &aclidx))
{
fprintf (stderr, "%s: illegal acl entries\n", prog_name);
@@ -780,10 +765,7 @@ main (int argc, char **argv)
if (action == NoAction)
action = Set;
else
- {
- usage (stderr);
- return 1;
- }
+ usage (stderr);
if (! getaclentries (Set, optarg, acls, &aclidx))
{
fprintf (stderr, "%s: illegal acl entries\n", prog_name);
@@ -798,15 +780,9 @@ main (int argc, char **argv)
return 1;
}
if (action == NoAction)
- {
- usage (stderr);
- return 1;
- }
+ usage (stderr);
if (optind > argc - 1)
- {
- usage (stderr);
- return 1;
- }
+ usage (stderr);
if (action == Set)
switch (aclcheck (acls, aclidx, NULL))
{