diff options
author | Jim Meyering <jim@meyering.net> | 2002-06-07 14:39:09 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 2002-06-07 14:39:09 +0000 |
commit | b965b62436ac4376d452980671dd4ecded5edf97 (patch) | |
tree | 7036c19a4c27751bb234e13a9629962ec2ccede8 /src | |
parent | 8bd3e55a54cba732637ee461701fae1741b1fd78 (diff) | |
download | coreutils-b965b62436ac4376d452980671dd4ecded5edf97.tar.xz |
(remove_entry): Use DT_IS_DIR only if
HAVE_STRUCT_DIRENT_D_TYPE is defined.
Diffstat (limited to 'src')
-rw-r--r-- | src/remove.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/remove.c b/src/remove.c index 35a31d0aa..cd4ef6e45 100644 --- a/src/remove.c +++ b/src/remove.c @@ -611,7 +611,12 @@ prompt (char const *filename, struct rm_options const *x, return RM_OK; } -#define DT_IS_DIR(D) ((D)->d_type == DT_DIR) +#if HAVE_STRUCT_DIRENT_D_TYPE +# define DT_IS_DIR(D) ((D)->d_type == DT_DIR) +#else +/* Use this only if the member exists -- i.e., don't return 0. */ +# define DT_IS_DIR(D) do_not_use_this_macro +#endif #define DO_UNLINK(Filename, X) \ do \ @@ -675,13 +680,15 @@ remove_entry (char const *filename, struct rm_options const *x, #if ROOT_CAN_UNLINK_DIRS - /* If we don't already know whether FILENAME is a directory, - find out now. */ + /* If we don't already know whether FILENAME is a directory, find out now. + Then, if it's a non-directory, we can use unlink on it. */ if (is_dir == T_UNKNOWN) { +# if HAVE_STRUCT_DIRENT_D_TYPE if (dp) is_dir = DT_IS_DIR (dp) ? T_YES : T_NO; else +# endif { struct stat sbuf; if (lstat (filename, &sbuf)) |