If the fts_open call fails, exit nonzero.
Otherwise, return nonzero upon error. */
-static int
+static bool
du_files (char **files, int bit_flags)
{
- int fail = 0;
+ bool fail = false;
FTS *fts = xfts_open (files, bit_flags, NULL);
{
/* FIXME: try to give a better message */
error (0, errno, _("fts_read failed"));
- fail = 1;
+ fail = true;
}
break;
}
char *cwd_only[2];
int max_depth_specified = 0;
char **files;
- int fail;
+ bool fail;
char *files_from = NULL;
+ struct Tokens tok;
/* Bit flags that control how fts works. */
int bit_flags = FTS_PHYSICAL | FTS_TIGHT_CYCLE_CHECK;
human_output_opts = human_options (getenv ("DU_BLOCK_SIZE"), false,
&output_block_size);
- fail = 0;
+ fail = false;
while ((c = getopt_long (argc, argv, DEBUG_OPT "0abchHklmsxB:DLPSX:",
long_options, NULL)) != -1)
{
{
error (0, 0, _("invalid maximum depth %s"),
quote (optarg));
- fail = 1;
+ fail = true;
}
break;
EXCLUDE_WILDCARDS, '\n'))
{
error (0, errno, "%s", quotearg_colon (optarg));
- fail = 1;
+ fail = true;
}
break;
case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
default:
- fail = 1;
+ fail = true;
}
}
size_t i;
bool valid = true;
bool read_fail;
- struct Tokens tok;
/* When using --files0-from=F, you may not specify any files
on the command-line. */
/* Initialize the hash structure for inode numbers. */
hash_init ();
- exit (du_files (files, bit_flags) || G_fail
- ? EXIT_FAILURE : EXIT_SUCCESS);
+ fail = du_files (files, bit_flags);
+
+ /* This isn't really necessary, but it does ensure we
+ exercise this function. */
+ if (files_from)
+ readtokens0_free (&tok);
+
+ exit (fail || G_fail ? EXIT_FAILURE : EXIT_SUCCESS);
}