From: Jim Meyering Date: Tue, 21 Jan 2003 18:49:49 +0000 (+0000) Subject: (remove_entry) [ROOT_CAN_UNLINK_DIRS && HAVE_STRUCT_DIRENT_D_TYPE]: If a file X-Git-Tag: v4.5.5~121 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c59a8e2d32e25ab8807335dbb2d34f19b23e2825;p=thirdparty%2Fcoreutils.git (remove_entry) [ROOT_CAN_UNLINK_DIRS && HAVE_STRUCT_DIRENT_D_TYPE]: If a file 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. --- diff --git a/src/remove.c b/src/remove.c index 95e331a843..e9223fd537 100644 --- a/src/remove.c +++ b/src/remove.c @@ -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