1
0
mirror of git://git.sv.gnu.org/coreutils.git synced 2026-08-05 08:10:15 +02:00

(HAVE_WORKING_READDIR): Define to 0 if not defined.

(IF_READDIR_NEEDS_REWINDDIR): Remove.
(remove_cwd_entries): Rewrite to avoid IF_READDIR_NEEDS_REWINDDIR,
which was a bit weird because it couldn't be emulated by a function.
This commit is contained in:
Jim Meyering
2003-05-04 07:10:21 +00:00
parent c48100ccf1
commit 87c13cce86
+8 -15
View File
@@ -55,10 +55,8 @@
# define ROOT_CAN_UNLINK_DIRS 1
#endif
#if HAVE_WORKING_READDIR
# define IF_READDIR_NEEDS_REWINDDIR(Code) /* empty */
#else
# define IF_READDIR_NEEDS_REWINDDIR(Code) Code
#ifndef HAVE_WORKING_READDIR
# define HAVE_WORKING_READDIR 0
#endif
enum Ternary
@@ -810,7 +808,7 @@ remove_cwd_entries (Dirstack_state *ds, char **subdir, struct stat *subdir_sb,
DIR *dirp = opendir (".");
struct AD_ent *top = AD_stack_top (ds);
enum RM_status status = top->status;
IF_READDIR_NEEDS_REWINDDIR (int performed_unlink_or_rmdir = 0);
bool need_rewinddir = false;
assert (VALID_STATUS (status));
*subdir = NULL;
@@ -846,18 +844,13 @@ remove_cwd_entries (Dirstack_state *ds, char **subdir, struct stat *subdir_sb,
/* Arrange to give a diagnostic after exiting this loop. */
dirp = NULL;
}
else
else if (need_rewinddir)
{
#if ! HAVE_WORKING_READDIR
/* On buggy systems, call rewinddir if we've called unlink
or rmdir since the opendir or a previous rewinddir. */
if (performed_unlink_or_rmdir)
{
rewinddir (dirp);
performed_unlink_or_rmdir = 0;
continue;
}
#endif
rewinddir (dirp);
need_rewinddir = false;
continue;
}
break;
}
@@ -878,7 +871,7 @@ remove_cwd_entries (Dirstack_state *ds, char **subdir, struct stat *subdir_sb,
case RM_OK:
/* On buggy systems, record the fact that we've just
removed a directory entry. */
IF_READDIR_NEEDS_REWINDDIR (performed_unlink_or_rmdir = 1);
need_rewinddir = ! HAVE_WORKING_READDIR;
break;
case RM_ERROR: