mirror of
git://git.suckless.org/sbase
synced 2025-03-21 10:30:48 +00:00
find: Don't exit successfully after errors
This commit is contained in:
parent
8f9824e34b
commit
5567976329
4
find.c
4
find.c
@ -964,6 +964,7 @@ find(char *path, struct findhist *hist)
|
|||||||
|
|
||||||
if (do_stat(path, &st, hist) < 0) {
|
if (do_stat(path, &st, hist) < 0) {
|
||||||
weprintf("failed to stat %s:", path);
|
weprintf("failed to stat %s:", path);
|
||||||
|
gflags.ret = 1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -985,6 +986,7 @@ find(char *path, struct findhist *hist)
|
|||||||
for (f = hist; f; f = f->next) {
|
for (f = hist; f; f = f->next) {
|
||||||
if (f->dev == st.st_dev && f->ino == st.st_ino) {
|
if (f->dev == st.st_dev && f->ino == st.st_ino) {
|
||||||
weprintf("loop detected '%s' is '%s'\n", path, f->path);
|
weprintf("loop detected '%s' is '%s'\n", path, f->path);
|
||||||
|
gflags.ret = 1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -995,6 +997,7 @@ find(char *path, struct findhist *hist)
|
|||||||
|
|
||||||
if (!(dir = opendir(path))) {
|
if (!(dir = opendir(path))) {
|
||||||
weprintf("failed to opendir %s:", path);
|
weprintf("failed to opendir %s:", path);
|
||||||
|
gflags.ret = 1;
|
||||||
/* should we just ignore this since we hit an error? */
|
/* should we just ignore this since we hit an error? */
|
||||||
if (gflags.depth)
|
if (gflags.depth)
|
||||||
eval(root, &arg);
|
eval(root, &arg);
|
||||||
@ -1018,6 +1021,7 @@ find(char *path, struct findhist *hist)
|
|||||||
free(pathbuf);
|
free(pathbuf);
|
||||||
if (errno) {
|
if (errno) {
|
||||||
weprintf("readdir %s:", path);
|
weprintf("readdir %s:", path);
|
||||||
|
gflags.ret = 1;
|
||||||
closedir(dir);
|
closedir(dir);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user