]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
(remove_entry) [ROOT_CAN_UNLINK_DIRS && HAVE_STRUCT_DIRENT_D_TYPE]: If a file
authorJim Meyering <jim@meyering.net>
Tue, 21 Jan 2003 18:49:49 +0000 (18:49 +0000)
committerJim Meyering <jim@meyering.net>
Tue, 21 Jan 2003 18:49:49 +0000 (18:49 +0000)
has d_type == DT_UNKNOWN it may still be a directory -- or not (e.g., with
FreeBSD on an NFS-mounted file system), so resort to calling lstat to find out.

src/remove.c

index 95e331a843b5cfc9b88b9422e86632386872a7e9..e9223fd5374b6f06d8fe2b94a6f0f724efc60ba8 100644 (file)
@@ -695,7 +695,7 @@ remove_entry (Dirstack_state const *ds, char const *filename,
   if (is_dir == T_UNKNOWN)
     {
 # if HAVE_STRUCT_DIRENT_D_TYPE
-      if (dp)
+      if (dp && dp->d_type != DT_UNKNOWN)
        is_dir = DT_IS_DIR (dp) ? T_YES : T_NO;
       else
 # endif