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)) {
line[width] = '\n';
line[width + 1] = '\0';
}
- printf(line);
+ printf("%s", line);
}
if(height >= 0 && nb_nodes > height && show_top && !forced_height) {