From ac823e21c01e063b28a146cfb06477db7a989b12 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Wed, 19 Feb 2003 22:20:45 +0000 Subject: Include "mmap-stack.h". (du_files): Add prototype with ATTRIBUTE_NORETURN. Exit from this function, not from... (main): ...here. Instead, if possible, invoke du_files through a macro that runs it with a large, mmap'd stack. --- src/du.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/du.c') diff --git a/src/du.c b/src/du.c index fbc07b534..95aa4d98c 100644 --- a/src/du.c +++ b/src/du.c @@ -37,6 +37,7 @@ #include "ftw.h" #include "hash.h" #include "human.h" +#include "mmap-stack.h" #include "quote.h" #include "quotearg.h" #include "same.h" @@ -497,7 +498,8 @@ is_symlink_to_dir (char const *file) FTW_FLAGS controls how nftw works. Return nonzero upon error. */ -static int +static void du_files (char **files, int ftw_flags) ATTRIBUTE_NORETURN; +static void du_files (char **files, int ftw_flags) { int fail = 0; @@ -544,7 +546,7 @@ du_files (char **files, int ftw_flags) if (print_totals) print_size (tot_size, _("total")); - return fail; + exit (fail || G_fail ? EXIT_FAILURE : EXIT_SUCCESS); } int @@ -716,6 +718,5 @@ main (int argc, char **argv) /* Initialize the hash structure for inode numbers. */ hash_init (); - exit (du_files (files, ftw_flags) || G_fail - ? EXIT_FAILURE : EXIT_SUCCESS); + RUN_WITH_BIG_STACK_2 (du_files, files, ftw_flags); } -- cgit v1.2.3-54-g00ecf