X-Git-Url: https://fleuret.org/cgi-bin/gitweb/gitweb.cgi?a=blobdiff_plain;f=dus.c;h=c698d2e551c35f610ad5086cd54c2ba35c816a74;hb=e299f447aad7b0ad4db7ccd745ff224a85c4ca93;hp=7cdf03efaef2a9479b8cb50a133d641bbf66c95d;hpb=b7c335904088b20ca454b5955d43c04facc7a353;p=dus.git diff --git a/dus.c b/dus.c index 7cdf03e..c698d2e 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)) { @@ -370,7 +374,7 @@ void print_sorted(struct entry_node *root, int width, int height) { line[width] = '\n'; line[width + 1] = '\0'; } - printf(line); + printf("%s", line); } if(height >= 0 && nb_nodes > height && show_top && !forced_height) {