Author: delphij
Date: Wed Jun 20 21:10:38 2012
New Revision: 237339
URL: http://svn.freebsd.org/changeset/base/237339

Log:
  Polish previous revision: if the fts_* routines have lstat()'ed the
  directory entry then use the struct stat from that instead of doing
  it again, and skip the rm_overwrite() call if fts_read() indicated
  that the entry couldn't be a regular file.
  
  Obtained from:        OpenBSD
  MFC after:    1 week

Modified:
  head/bin/rm/rm.c

Modified: head/bin/rm/rm.c
==============================================================================
--- head/bin/rm/rm.c    Wed Jun 20 21:06:51 2012        (r237338)
+++ head/bin/rm/rm.c    Wed Jun 20 21:10:38 2012        (r237339)
@@ -301,10 +301,16 @@ rm_tree(char **argv)
                                if (fflag)
                                        continue;
                                /* FALLTHROUGH */
-                       default:
+
+                       case FTS_F:
+                       case FTS_NSOK:
                                if (Pflag)
-                                       if (!rm_overwrite(p->fts_accpath, NULL))
+                                       if (!rm_overwrite(p->fts_accpath, 
p->fts_info ==
+                                           FTS_NSOK ? NULL : p->fts_statp))
                                                continue;
+                               /* FALLTHROUGH */
+
+                       default:
                                rval = unlink(p->fts_accpath);
                                if (rval == 0 || (fflag && errno == ENOENT)) {
                                        if (rval == 0 && vflag)
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to