]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
hwclock: don't always use hwclock_exit
authorJ William Piggott <elseifthen@gmx.com>
Sun, 3 Sep 2017 16:23:44 +0000 (12:23 -0400)
committerJ William Piggott <elseifthen@gmx.com>
Sun, 3 Sep 2017 16:23:44 +0000 (12:23 -0400)
Special exit handling is not wanted for usage() or bad
command syntax. For example we do not want to audit:
hwclock --set --date foo

Signed-off-by: J William Piggott <elseifthen@gmx.com>
sys-utils/hwclock.c

index 82f9190483b11fadfa2f10285b396f12014fc6b3..e471fe1aef7c4635872d520b5e9576459c3ae7ee 100644 (file)
@@ -1061,7 +1061,7 @@ static void out_version(void)
 }
 
 static void __attribute__((__noreturn__))
-usage(const struct hwclock_control *ctl)
+usage(void)
 {
        fputs(USAGE_HEADER, stdout);
        printf(_(" %s [function] [option...]\n"), program_invocation_short_name);
@@ -1105,7 +1105,7 @@ usage(const struct hwclock_control *ctl)
        fputs(USAGE_SEPARATOR, stdout);
        printf(USAGE_HELP_OPTIONS(22));
        printf(USAGE_MAN_TAIL("hwclock(8)"));
-       hwclock_exit(ctl, EXIT_SUCCESS);
+       exit(EXIT_SUCCESS);
 }
 
 int main(int argc, char **argv)
@@ -1301,7 +1301,7 @@ int main(int argc, char **argv)
                        out_version();
                        return 0;
                case 'h':                       /* --help */
-                       usage(&ctl);
+                       usage();
                default:
                        errtryhelp(EXIT_FAILURE);
                }
@@ -1317,25 +1317,25 @@ int main(int argc, char **argv)
 
        if (ctl.update && !ctl.set && !ctl.systohc) {
                warnx(_("--update-drift requires --set or --systohc"));
-               hwclock_exit(&ctl, EXIT_FAILURE);
+               exit(EXIT_FAILURE);
        }
 
        if (ctl.noadjfile && !ctl.utc && !ctl.local_opt) {
                warnx(_("With --noadjfile, you must specify "
                        "either --utc or --localtime"));
-               hwclock_exit(&ctl, EXIT_FAILURE);
+               exit(EXIT_FAILURE);
        }
 
        if (ctl.set || ctl.predict) {
                if (!ctl.date_opt) {
                warnx(_("--date is required for --set or --predict"));
-               hwclock_exit(&ctl, EXIT_FAILURE);
+               exit(EXIT_FAILURE);
                }
                if (parse_date(&when, ctl.date_opt, NULL))
                        set_time = when.tv_sec;
                else {
                        warnx(_("invalid date '%s'"), ctl.date_opt);
-                       hwclock_exit(&ctl, EXIT_FAILURE);
+                       exit(EXIT_FAILURE);
                }
        }