(prompt): Fix test for write-protectedness to also
authorJim Meyering <jim@meyering.net>
Thu, 4 Jul 2002 12:06:49 +0000 (12:06 +0000)
committerJim Meyering <jim@meyering.net>
Thu, 4 Jul 2002 12:06:49 +0000 (12:06 +0000)
check errno == EACCES.  Otherwise, `rm dangling-symlink' would
mistakenly prompt.

src/remove.c

index bd1989f6c1e1f8264d08b573ab570eda8cc33cb6..394e4c48405fadafdf6dc531a714921a1273931e 100644 (file)
@@ -560,7 +560,7 @@ prompt (char const *filename, struct rm_options const *x,
   *is_dir = T_UNKNOWN;
 
   if ((!x->ignore_missing_files && (x->interactive || x->stdin_tty)
-       && (write_protected = euidaccess (filename, W_OK)))
+       && (write_protected = (euidaccess (filename, W_OK) && errno == EACCES)))
       || x->interactive)
     {
       struct stat sbuf;