Index: remove.c =================================================================== RCS file: /fetish/cu/src/remove.c,v retrieving revision 1.145 diff -u -p -r1.145 remove.c --- remove.c 11 Feb 2006 19:25:02 -0000 1.145 +++ remove.c 11 Feb 2006 20:28:15 -0000 @@ -202,9 +202,10 @@ pop_dir (Dirstack_state *ds) { size_t n_lengths = obstack_object_size (&ds->len_stack) / sizeof (size_t); size_t *length = obstack_base (&ds->len_stack); + size_t top_len; assert (n_lengths > 0); - size_t top_len = length[n_lengths - 1]; + top_len = length[n_lengths - 1]; assert (top_len >= 2); /* Pop the specified length of file name. */ @@ -336,10 +337,11 @@ AD_stack_top (Dirstack_state const *ds) static void AD_stack_pop (Dirstack_state *ds) { + struct AD_ent *top; assert (0 < AD_stack_height (ds)); /* operate on Active_dir. pop and free top entry */ - struct AD_ent *top = AD_stack_top (ds); + top = AD_stack_top (ds); if (top->unremovable) hash_free (top->unremovable); obstack_blank (&ds->Active_dir, -(int) sizeof (struct AD_ent)); @@ -1019,6 +1021,7 @@ fd_to_subdirp (int fd_cwd, char const *f return NULL; } + { DIR *subdir_dirp = fdopendir (fd_sub); if (subdir_dirp == NULL) { @@ -1027,6 +1030,7 @@ fd_to_subdirp (int fd_cwd, char const *f } return subdir_dirp; + } } /* Remove entries in the directory open on DIRP @@ -1257,9 +1261,10 @@ remove_dir (int fd_cwd, Dirstack_state * /* The name of the directory that we have just processed, nominally removing all of its contents. */ char *empty_dir; + int fd; AD_pop_and_chdir (&dirp, ds, &empty_dir); - int fd = (dirp != NULL ? dirfd (dirp) : AT_FDCWD); + fd = (dirp != NULL ? dirfd (dirp) : AT_FDCWD); assert (dirp != NULL || AD_stack_height (ds) == 1); /* Try to remove EMPTY_DIR only if remove_cwd_entries succeeded. */ @@ -1336,6 +1341,7 @@ rm_1 (Dirstack_state *ds, char const *fi AD_push_initial (ds); AD_INIT_OTHER_MEMBERS (); + { int fd_cwd = AT_FDCWD; enum RM_status status = remove_entry (fd_cwd, ds, filename, x, NULL); if (status == RM_NONEMPTY_DIR) @@ -1352,6 +1358,7 @@ rm_1 (Dirstack_state *ds, char const *fi ds_clear (ds); return status; + } } /* Remove all files and/or directories specified by N_FILES and FILE. @@ -1374,9 +1381,11 @@ rm (size_t n_files, char const *const *f } cycle_check_init (&ds->cycle_check_state); + { enum RM_status s = rm_1 (ds, file[i], x, &cwd_errno); assert (VALID_STATUS (s)); UPDATE_STATUS (status, s); + } } if (x->require_restore_cwd && cwd_errno)