Patch from Denis Vlasenko to add xstat() and use it.
diff --git a/findutils/find.c b/findutils/find.c
index 0f2f214..c6aaf7a 100644
--- a/findutils/find.c
+++ b/findutils/find.c
@@ -274,15 +274,13 @@
xdev_dev = xmalloc ( xdev_count * sizeof( dev_t ));
if ( firstopt == 1 ) {
- if ( stat ( ".", &stbuf ) < 0 )
- bb_error_msg_and_die("could not stat '.'" );
+ xstat ( ".", &stbuf );
xdev_dev [0] = stbuf. st_dev;
}
else {
for (i = 1; i < firstopt; i++) {
- if ( stat ( argv [i], &stbuf ) < 0 )
- bb_error_msg_and_die("could not stat '%s'", argv [i] );
+ xstat ( argv [i], &stbuf );
xdev_dev [i-1] = stbuf. st_dev;
}
}
@@ -292,8 +290,7 @@
struct stat stat_newer;
if (++i == argc)
bb_error_msg_and_die(msg_req_arg, "-newer");
- if (stat (argv[i], &stat_newer) != 0)
- bb_error_msg_and_die("file %s not found", argv[i]);
+ xstat (argv[i], &stat_newer);
newer_mtime = stat_newer.st_mtime;
#endif
#ifdef CONFIG_FEATURE_FIND_INUM