The following commit has been merged in the master branch:
commit 1dddc6d46dbf6f3611cf0979e27547d06f9549c3
Author: Guillem Jover <guil...@debian.org>
Date:   Wed Sep 8 03:57:10 2010 +0200

    dpkg: Rename unlinkorrmdir() to secure_remove()
    
    Maps better to the system remove(2) function name.

diff --git a/src/archives.c b/src/archives.c
index d1daed4..fdfad13 100644
--- a/src/archives.c
+++ b/src/archives.c
@@ -311,24 +311,27 @@ void setupfnamevbs(const char *filename) {
         fnamevb.buf, fnametmpvb.buf, fnamenewvb.buf);
 }
 
-int unlinkorrmdir(const char *filename) {
+int
+secure_remove(const char *filename)
+{
   /* Returns 0 on success or -1 on failure, just like unlink & rmdir */
   int r, e;
   
   if (!rmdir(filename)) {
-    debug(dbg_eachfiledetail,"unlinkorrmdir `%s' rmdir OK",filename);
+    debug(dbg_eachfiledetail, "secure_remove '%s' rmdir OK", filename);
     return 0;
   }
   
   if (errno != ENOTDIR) {
     e= errno;
-    debug(dbg_eachfiledetail,"unlinkorrmdir `%s' rmdir 
%s",filename,strerror(e));
+    debug(dbg_eachfiledetail, "secure_remove '%s' rmdir %s", filename,
+          strerror(e));
     errno= e; return -1;
   }
   
   r = secure_unlink(filename);
   e = errno;
-  debug(dbg_eachfiledetail,"unlinkorrmdir `%s' unlink %s",
+  debug(dbg_eachfiledetail, "secure_remove '%s' unlink %s",
         filename, r ? strerror(e) : "OK");
   errno= e; return r;
 }
diff --git a/src/archives.h b/src/archives.h
index 9f47aa2..0150086 100644
--- a/src/archives.h
+++ b/src/archives.h
@@ -62,7 +62,8 @@ void cu_prermdeconfigure(int argc, void **argv);
 void ok_prermdeconfigure(int argc, void **argv);
 
 void setupfnamevbs(const char *filename);
-int unlinkorrmdir(const char *filename);
+
+int secure_remove(const char *filename);
 
 int tarobject(void *ctx, struct tar_entry *ti);
 int tarfileread(void *ud, char *buf, int len);
diff --git a/src/cleanup.c b/src/cleanup.c
index e31ee9d..484232d 100644
--- a/src/cleanup.c
+++ b/src/cleanup.c
@@ -81,7 +81,7 @@ void cu_installnew(int argc, void **argv) {
        * link to the new version we may have created.
        */
       debug(dbg_eachfiledetail,"cu_installnew restoring nonatomic");
-      if (unlinkorrmdir(fnamevb.buf) && errno != ENOENT && errno != ENOTDIR)
+      if (secure_remove(fnamevb.buf) && errno != ENOENT && errno != ENOTDIR)
         ohshite(_("unable to remove newly-installed version of `%.250s' to 
allow"
                 " reinstallation of backup copy"),namenode->name);
     } else {
@@ -96,14 +96,14 @@ void cu_installnew(int argc, void **argv) {
       ohshite(_("unable to remove backup copy of '%.250s'"), namenode->name);
   } else if (namenode->flags & fnnf_placed_on_disk) {
     debug(dbg_eachfiledetail,"cu_installnew removing new file");
-    if (unlinkorrmdir(fnamevb.buf) && errno != ENOENT && errno != ENOTDIR)
+    if (secure_remove(fnamevb.buf) && errno != ENOENT && errno != ENOTDIR)
       ohshite(_("unable to remove newly-installed version of `%.250s'"),
              namenode->name);
   } else {
     debug(dbg_eachfiledetail,"cu_installnew not restoring");
   }
   /* Whatever, we delete <foo>.dpkg-new now, if it still exists. */
-  if (unlinkorrmdir(fnamenewvb.buf) && errno != ENOENT && errno != ENOTDIR)
+  if (secure_remove(fnamenewvb.buf) && errno != ENOENT && errno != ENOTDIR)
     ohshite(_("unable to remove newly-extracted version of 
`%.250s'"),namenode->name);
 
   cleanup_pkg_failed--; cleanup_conflictor_failed--;

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to