diff options
author | Pádraig Brady <P@draigBrady.com> | 2016-10-15 23:10:35 +0100 |
---|---|---|
committer | Pádraig Brady <P@draigBrady.com> | 2016-10-16 12:23:55 +0100 |
commit | 492dcb2eb191b844a2fd5e51db3eed85289bea1f (patch) | |
tree | 910f93d88891b573520ebd5c812d61ddc7fbeed8 /src/du.c | |
parent | d035eacfdeba2da0134e606c8a63b2f3c0bd05bb (diff) | |
download | coreutils-492dcb2eb191b844a2fd5e51db3eed85289bea1f.tar.xz |
all: use die() rather than error(EXIT_FAILURE)
die() has the advantage of being apparent to the compiler
that it doesn't return, which will avoid warnings in some cases,
and possibly generate better code.
* cfg.mk (sc_die_EXIT_FAILURE): A new syntax check rule to
catch any new uses of error (CONSTANT, ...);
Diffstat (limited to 'src/du.c')
-rw-r--r-- | src/du.c | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -31,6 +31,7 @@ #include "argmatch.h" #include "argv-iter.h" #include "di-set.h" +#include "die.h" #include "error.h" #include "exclude.h" #include "fprintftime.h" @@ -845,7 +846,7 @@ main (int argc, char **argv) if (opt_threshold == 0 && *optarg == '-') { /* Do not allow -0, as this wouldn't make sense anyway. */ - error (EXIT_FAILURE, 0, _("invalid --threshold argument '-0'")); + die (EXIT_FAILURE, 0, _("invalid --threshold argument '-0'")); } } break; @@ -1022,8 +1023,8 @@ main (int argc, char **argv) } if (! (STREQ (files_from, "-") || freopen (files_from, "r", stdin))) - error (EXIT_FAILURE, errno, _("cannot open %s for reading"), - quoteaf (files_from)); + die (EXIT_FAILURE, errno, _("cannot open %s for reading"), + quoteaf (files_from)); ai = argv_iter_init_stream (stdin); @@ -1130,7 +1131,7 @@ main (int argc, char **argv) di_set_free (di_mnt); if (files_from && (ferror (stdin) || fclose (stdin) != 0) && ok) - error (EXIT_FAILURE, 0, _("error reading %s"), quoteaf (files_from)); + die (EXIT_FAILURE, 0, _("error reading %s"), quoteaf (files_from)); if (print_grand_total) print_size (&tot_dui, _("total")); |