From 9931cb5194ed160f999e4e2d107a719445e1cf07 Mon Sep 17 00:00:00 2001 From: Francois Fleuret Date: Wed, 18 Aug 2010 18:22:53 +0200 Subject: [PATCH] Fixed the permission denied with the -i option on lstat(). --- dus.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/dus.c b/dus.c index 7cdf03e..9d1850c 100644 --- a/dus.c +++ b/dus.c @@ -104,10 +104,14 @@ size_sum_t entry_size(const char *name) { result = 0; if(lstat(name, &dummy) != 0) { - fprintf(stderr, - "dus: Can not stat %s: %s\n", - name, strerror(errno)); - exit(EXIT_FAILURE); + if(!(errno == EACCES && ignore_protected_files)) { + fprintf(stderr, + "dus: Can not stat %s: %s\n", + name, strerror(errno)); + exit(EXIT_FAILURE); + } else { + return 0; + } } if(S_ISLNK(dummy.st_mode)) { -- 2.20.1