diff options
author | Rob Landley <rob@landley.net> | 2021-02-01 22:13:12 -0600 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2021-02-01 22:13:12 -0600 |
commit | 551f355d248c52c867399dcfcda6abe174c940c9 (patch) | |
tree | 06fb2bc7ac15302ab9b73afe257fb1c12321f51d | |
parent | 40fbe7eb5e3b41504947d942bf39471fff8df1b7 (diff) | |
download | toybox-551f355d248c52c867399dcfcda6abe174c940c9.tar.gz |
Minor tweak.
-rw-r--r-- | toys/posix/rm.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/toys/posix/rm.c b/toys/posix/rm.c index b1fd0fee..be611e67 100644 --- a/toys/posix/rm.c +++ b/toys/posix/rm.c @@ -90,7 +90,6 @@ nodelete: void rm_main(void) { char **s; - struct stat st; // Can't use <1 in optstring because zero arguments with -f isn't an error if (!toys.optc && !FLAG(f)) help_exit("Needs 1 argument"); @@ -106,15 +105,13 @@ void rm_main(void) continue; } - // Files that already don't exist aren't errors for -f. - // We explicitly use lstat() but not faccessat() because Android bionic - // intentionally don't support AT_SYMLINK_NOFOLLOW. - if (FLAG(f) && lstat(*s, &st) && errno == ENOENT) continue; + // Files that already don't exist aren't errors for -f. Use lstat() instead + // of faccessat() because bionic doesn't support AT_SYMLINK_NOFOLLOW + if (FLAG(f) && lstat(*s, (void *)toybuf) && errno == ENOENT) continue; // There's a race here where a file removed between the above check and // dirtree's stat would report the nonexistence as an error, but that's // not a normal "it didn't exist" so I'm ok with it. - dirtree_read(*s, do_rm); } } |