diff options
author | Jim Meyering <jim@meyering.net> | 1997-10-17 18:06:34 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 1997-10-17 18:06:34 +0000 |
commit | c55572184218b75af2f70ad330a912f42674a8b4 (patch) | |
tree | dae5877e1a88a2e548ca3704bb7645512446aff3 | |
parent | 0dcc4a0d58bcdb352fc0c2f47ba9fc1e9dccfea7 (diff) | |
download | coreutils-c55572184218b75af2f70ad330a912f42674a8b4.tar.xz |
(remove_cwd_entries): Change the while(dp...) to a while(1) loop,
and move dcl and assignment of dp into the loop.
-rw-r--r-- | src/rm.c | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -537,7 +537,6 @@ remove_cwd_entries (void) due either to an error or to an interactive `no' response. */ struct HT *ht = NULL; - struct dirent *dp; enum RM_status status = RM_OK; if (dirp) @@ -553,7 +552,9 @@ remove_cwd_entries (void) do { + /* FIXME: why do this? */ errno = 0; + dirp = opendir ("."); if (dirp == NULL) { @@ -565,11 +566,16 @@ remove_cwd_entries (void) break; } - while ((dp = readdir (dirp)) != NULL) + while (1) { char *entry_name; struct File_spec fs; enum RM_status tmp_status; + struct dirent *dp; + + dp = readdir (dirp); + if (dp == NULL) + break; /* Skip this entry if it's `.' or `..'. */ if (DOT_OR_DOTDOT (dp->d_name)) |