From: Francois Fleuret Date: Wed, 18 Aug 2010 16:22:53 +0000 (+0200) Subject: Fixed the permission denied with the -i option on lstat(). X-Git-Url: https://fleuret.org/cgi-bin/gitweb/gitweb.cgi?a=commitdiff_plain;h=9931cb5194ed160f999e4e2d107a719445e1cf07;p=dus.git Fixed the permission denied with the -i option on lstat(). --- 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)) {