Преглед изворни кода

libdpkg: Rename ensure_pathname_nonexisting() to path_remove_tree()

Guillem Jover пре 11 година
родитељ
комит
ca2eb8ec82
5 измењених фајлова са 14 додато и 13 уклоњено
  1. 4 4
      src/archives.c
  2. 5 4
      src/help.c
  3. 1 1
      src/main.h
  4. 2 2
      src/remove.c
  5. 2 2
      src/unpack.c

+ 4 - 4
src/archives.c

@@ -225,7 +225,7 @@ md5hash_prev_conffile(struct pkginfo *pkg, char *oldhash, const char *oldname,
 }
 
 void cu_pathname(int argc, void **argv) {
-  ensure_pathname_nonexisting((char*)(argv[0]));
+  path_remove_tree((char*)(argv[0]));
 }
 
 int tarfileread(void *ud, char *buf, int len) {
@@ -974,8 +974,8 @@ tarobject(void *ctx, struct tar_entry *ti)
   } else {
     /* Now, at this stage we want to make sure neither of .dpkg-new and
      * .dpkg-tmp are hanging around. */
-    ensure_pathname_nonexisting(fnamenewvb.buf);
-    ensure_pathname_nonexisting(fnametmpvb.buf);
+    path_remove_tree(fnamenewvb.buf);
+    path_remove_tree(fnametmpvb.buf);
 
     /* Now we start to do things that we need to be able to undo
      * if something goes wrong. Watch out for the CLEANUP comments to
@@ -1434,7 +1434,7 @@ void cu_cidir(int argc, void **argv) {
   char *cidir= (char*)argv[0];
   char *cidirrest= (char*)argv[1];
   cidirrest[-1] = '\0';
-  ensure_pathname_nonexisting(cidir);
+  path_remove_tree(cidir);
 }
 
 void cu_fileslist(int argc, void **argv) {

+ 5 - 4
src/help.c

@@ -366,14 +366,16 @@ secure_unlink_statted(const char *pathname, const struct stat *stab)
   return 0;
 }
 
-void ensure_pathname_nonexisting(const char *pathname) {
+void
+path_remove_tree(const char *pathname)
+{
   pid_t pid;
   const char *u;
 
   u = path_skip_slash_dotslash(pathname);
   assert(*u);
 
-  debug(dbg_eachfile, "ensure_pathname_nonexisting '%s'", pathname);
+  debug(dbg_eachfile, "%s '%s'", __func__, pathname);
   if (!rmdir(pathname))
     return; /* Deleted it OK, it was a directory. */
   if (errno == ENOENT || errno == ELOOP) return;
@@ -392,8 +394,7 @@ void ensure_pathname_nonexisting(const char *pathname) {
     execlp(RM, "rm", "-rf", "--", pathname, NULL);
     ohshite(_("unable to execute %s (%s)"), _("rm command for cleanup"), RM);
   }
-  debug(dbg_eachfile, "ensure_pathname_nonexisting running rm -rf '%s'",
-        pathname);
+  debug(dbg_eachfile, "%s running rm -rf '%s'", __func__, pathname);
   subproc_reap(pid, _("rm command for cleanup"), 0);
 }
 

+ 1 - 1
src/main.h

@@ -242,7 +242,7 @@ bool force_depends(struct deppossi *possi);
 bool force_conflicts(struct deppossi *possi);
 void conffile_mark_obsolete(struct pkginfo *pkg, struct filenamenode *namenode);
 void oldconffsetflags(const struct conffile *searchconff);
-void ensure_pathname_nonexisting(const char *pathname);
+void path_remove_tree(const char *pathname);
 int secure_unlink(const char *pathname);
 int secure_unlink_statted(const char *pathname, const struct stat *stab);
 void checkpath(void);

+ 2 - 2
src/remove.c

@@ -318,13 +318,13 @@ removal_bulk_remove_files(struct pkginfo *pkg)
       varbuf_add_str(&fnvb, DPKGTEMPEXT);
       varbuf_end_str(&fnvb);
       debug(dbg_eachfiledetail, "removal_bulk cleaning temp '%s'", fnvb.buf);
-      ensure_pathname_nonexisting(fnvb.buf);
+      path_remove_tree(fnvb.buf);
 
       varbuf_trunc(&fnvb, before);
       varbuf_add_str(&fnvb, DPKGNEWEXT);
       varbuf_end_str(&fnvb);
       debug(dbg_eachfiledetail, "removal_bulk cleaning new '%s'", fnvb.buf);
-      ensure_pathname_nonexisting(fnvb.buf);
+      path_remove_tree(fnvb.buf);
 
       varbuf_trunc(&fnvb, before);
       varbuf_end_str(&fnvb);

+ 2 - 2
src/unpack.c

@@ -189,7 +189,7 @@ get_control_dir(char *cidir)
     strcat(cidir, "/" CONTROLDIRTMP);
 
     /* Make sure the control information directory is empty. */
-    ensure_pathname_nonexisting(cidir);
+    path_remove_tree(cidir);
   }
 
   strcat(cidir, "/");
@@ -1457,7 +1457,7 @@ void process_archive(const char *filename) {
     varbuf_add_str(&fnametmpvb, usenode->name);
     varbuf_add_str(&fnametmpvb, DPKGTEMPEXT);
     varbuf_end_str(&fnametmpvb);
-    ensure_pathname_nonexisting(fnametmpvb.buf);
+    path_remove_tree(fnametmpvb.buf);
   }
 
   /* OK, we're now fully done with the main package.