Просмотр исходного кода

dpkg: Rename isdirectoryinuse() to dir_is_used_by_others()

This clarifies the action performed by the function, which could be
easily confused as being used by the given package, instead of by other
packages.
Guillem Jover лет назад: 15
Родитель
Сommit
ff6e32d358
4 измененных файлов с 11 добавлено и 8 удалено
  1. 4 4
      src/help.c
  2. 1 1
      src/main.h
  3. 2 1
      src/processarc.c
  4. 4 2
      src/remove.c

+ 4 - 4
src/help.c

@@ -490,17 +490,17 @@ dir_has_conffiles(struct filenamenode *file, struct pkginfo *pkg)
  * false otherwise.
  */
 bool
-isdirectoryinuse(struct filenamenode *file, struct pkginfo *pkg)
+dir_is_used_by_others(struct filenamenode *file, struct pkginfo *pkg)
 {
   struct filepackages_iterator *iter;
   struct pkginfo *other_pkg;
 
-  debug(dbg_veryverbose, "isdirectoryinuse `%s' (except %s)", file->name,
+  debug(dbg_veryverbose, "dir_is_used_by_others '%s' (except %s)", file->name,
         pkg ? pkg->name : "<none>");
 
   iter = filepackages_iter_new(file);
   while ((other_pkg = filepackages_iter_next(iter))) {
-    debug(dbg_veryverbose, "isdirectoryinuse considering %s ...",
+    debug(dbg_veryverbose, "dir_is_used_by_others considering %s ...",
           other_pkg->name);
     if (other_pkg == pkg)
       continue;
@@ -508,7 +508,7 @@ isdirectoryinuse(struct filenamenode *file, struct pkginfo *pkg)
   }
   filepackages_iter_free(iter);
 
-  debug(dbg_veryverbose, "isdirectoryinuse no");
+  debug(dbg_veryverbose, "dir_is_used_by_others no");
   return false;
 }
 

+ 1 - 1
src/main.h

@@ -248,7 +248,7 @@ void post_postinst_tasks_core(struct pkginfo *pkg);
 void post_postinst_tasks(struct pkginfo *pkg, enum pkgstatus new_status);
 
 void clear_istobes(void);
-bool isdirectoryinuse(struct filenamenode *namenode, struct pkginfo *pkg);
+bool dir_is_used_by_others(struct filenamenode *namenode, struct pkginfo *pkg);
 bool dir_has_conffiles(struct filenamenode *namenode, struct pkginfo *pkg);
 
 void log_action(const char *action, struct pkginfo *pkg);

+ 2 - 1
src/processarc.c

@@ -888,7 +888,8 @@ void process_archive(const char *filename) {
     if (!stat(namenode->name,&stab) && S_ISDIR(stab.st_mode)) {
       debug(dbg_eachfiledetail, "process_archive: %s is a directory",
 	    namenode->name);
-      if (isdirectoryinuse(namenode,pkg)) continue;
+      if (dir_is_used_by_others(namenode, pkg))
+        continue;
     }
 
     if (lstat(fnamevb.buf, &oldfs)) {

+ 4 - 2
src/remove.c

@@ -257,7 +257,8 @@ removal_bulk_remove_files(struct pkginfo *pkg)
 	  push_leftover(&leftover,namenode);
 	  continue;
 	}
-	if (isdirectoryinuse(namenode,pkg)) continue;
+        if (dir_is_used_by_others(namenode, pkg))
+          continue;
       }
       debug(dbg_eachfiledetail, "removal_bulk removing `%s'", fnvb.buf);
       if (!rmdir(fnvb.buf) || errno == ENOENT || errno == ELOOP) continue;
@@ -336,7 +337,8 @@ static void removal_bulk_remove_leftover_dirs(struct pkginfo *pkg) {
 	push_leftover(&leftover,namenode);
 	continue;
       }
-      if (isdirectoryinuse(namenode,pkg)) continue;
+      if (dir_is_used_by_others(namenode, pkg))
+        continue;
     }
 
     debug(dbg_eachfiledetail, "removal_bulk removing `%s'", fnvb.buf);