Bläddra i källkod

libdpkg: Rename subproc_wait_check() to subproc_reap()

Guillem Jover 12 år sedan
förälder
incheckning
59427cc7a4

+ 5 - 5
dpkg-deb/build.c

@@ -207,7 +207,7 @@ file_treewalk_feed(const char *dir, int fd_out)
   }
 
   close(pipefd[0]);
-  subproc_wait_check(pid, "find", 0);
+  subproc_reap(pid, "find", 0);
 
   for (fi = symlist; fi; fi = fi->next)
     if (fd_write(fd_out, fi->fn, strlen(fi->fn) + 1) < 0)
@@ -494,8 +494,8 @@ do_build(const char *const *argv)
     exit(0);
   }
   close(p1[0]);
-  subproc_wait_check(c2, "gzip -9c", 0);
-  subproc_wait_check(c1, "tar -cf", 0);
+  subproc_reap(c2, "gzip -9c", 0);
+  subproc_reap(c1, "tar -cf", 0);
 
   if (lseek(gzfd, 0, SEEK_SET))
     ohshite(_("failed to rewind temporary file (%s)"), _("control member"));
@@ -582,8 +582,8 @@ do_build(const char *const *argv)
 
   /* All done, clean up wait for tar and gzip to finish their job. */
   close(p1[1]);
-  subproc_wait_check(c2, _("<compress> from tar -cf"), 0);
-  subproc_wait_check(c1, "tar -cf", 0);
+  subproc_reap(c2, _("<compress> from tar -cf"), 0);
+  subproc_reap(c1, "tar -cf", 0);
   /* Okay, we have data.tar as well now, add it to the ar wrapper. */
   if (deb_format.major == 2) {
     char datamember[16 + 1];

+ 4 - 4
dpkg-deb/extract.c

@@ -62,7 +62,7 @@ static void movecontrolfiles(const char *thing) {
   if (pid == 0) {
     command_shell(buf, _("shell command to move files"));
   }
-  subproc_wait_check(pid, _("shell command to move files"), 0);
+  subproc_reap(pid, _("shell command to move files"), 0);
 }
 
 static void DPKG_ATTR_NORET
@@ -356,12 +356,12 @@ extracthalf(const char *debar, const char *dir,
       command_exec(&cmd);
     }
     close(p2[0]);
-    subproc_wait_check(c3, "tar", 0);
+    subproc_reap(c3, "tar", 0);
   }
 
-  subproc_wait_check(c2, _("<decompress>"), PROCPIPE);
+  subproc_reap(c2, _("<decompress>"), PROCPIPE);
   if (c1 != -1)
-    subproc_wait_check(c1, _("paste"), 0);
+    subproc_reap(c1, _("paste"), 0);
   if (version.major == 0 && admininfo) {
     /* Handle the version as a float to preserve the behaviour of old code,
      * because even if the format is defined to be padded by 0's that might

+ 1 - 1
dpkg-deb/info.c

@@ -65,7 +65,7 @@ static void cu_info_prepare(int argc, void **argv) {
     execlp(RM, "rm", "-rf", dir, NULL);
     ohshite(_("unable to execute %s (%s)"), _("rm command for cleanup"), RM);
   }
-  subproc_wait_check(pid, _("rm command for cleanup"), 0);
+  subproc_reap(pid, _("rm command for cleanup"), 0);
 }
 
 static void info_prepare(const char *const **argvp,

+ 1 - 1
dpkg-split/split.c

@@ -82,7 +82,7 @@ deb_field(const char *filename, const char *field)
 
 	close(p[0]);
 
-	subproc_wait_check(pid, _("package field value extraction"), PROCPIPE);
+	subproc_reap(pid, _("package field value extraction"), PROCPIPE);
 
 	/* Trim down trailing junk. */
 	for (end = buf.buf + strlen(buf.buf) - 1; end - buf.buf >= 1; end--)

+ 1 - 1
dselect/method.cc

@@ -150,7 +150,7 @@ falliblesubprocess(struct command *cmd)
 
   fprintf(stderr, "\n");
 
-  i = subproc_wait_check(pid, cmd->name, PROCWARN);
+  i = subproc_reap(pid, cmd->name, PROCWARN);
 
   pop_cleanup(ehflag_normaltidy);
 

+ 1 - 1
lib/dpkg/compress.c

@@ -81,7 +81,7 @@ fd_fd_filter(int fd_in, int fd_out, const char *desc, const char *delenv[],
 
 		command_exec(&cmd);
 	}
-	subproc_wait_check(pid, desc, 0);
+	subproc_reap(pid, desc, 0);
 }
 #endif
 

+ 1 - 1
lib/dpkg/file.c

@@ -173,5 +173,5 @@ file_show(const char *filename)
 		command_add_arg(&cmd, filename);
 		command_exec(&cmd);
 	}
-	subproc_wait_check(pid, _("showing file on pager"), PROCNOCHECK);
+	subproc_reap(pid, _("showing file on pager"), PROCNOCHECK);
 }

+ 1 - 1
lib/dpkg/libdpkg.map

@@ -134,7 +134,7 @@ LIBDPKG_PRIVATE {
 	subproc_signals_setup;
 	subproc_signals_cleanup;
 	subproc_fork;
-	subproc_wait_check;
+	subproc_reap;
 
 	command_init;
 	command_add_arg;

+ 1 - 1
lib/dpkg/subproc.c

@@ -155,7 +155,7 @@ subproc_wait(pid_t pid, const char *desc)
 }
 
 int
-subproc_wait_check(pid_t pid, const char *desc, int flags)
+subproc_reap(pid_t pid, const char *desc, int flags)
 {
 	int status, rc;
 

+ 1 - 1
lib/dpkg/subproc.h

@@ -42,7 +42,7 @@ void subproc_signals_cleanup(int argc, void **argv);
 #define PROCNOCHECK 8
 
 pid_t subproc_fork(void);
-int subproc_wait_check(pid_t pid, const char *desc, int flags);
+int subproc_reap(pid_t pid, const char *desc, int flags);
 
 /** @} */
 

+ 4 - 4
lib/dpkg/test/t-command.c

@@ -178,7 +178,7 @@ test_command_exec(void)
 	if (pid == 0)
 		command_exec(&cmd);
 
-	ret = subproc_wait_check(pid, "command exec test", 0);
+	ret = subproc_reap(pid, "command exec test", 0);
 	test_pass(ret == 0);
 }
 
@@ -191,20 +191,20 @@ test_command_shell(void)
 	pid = subproc_fork();
 	if (pid == 0)
 		command_shell("true", "command shell pass test");
-	ret = subproc_wait_check(pid, "command shell pass test", 0);
+	ret = subproc_reap(pid, "command shell pass test", 0);
 	test_pass(ret == 0);
 
 	pid = subproc_fork();
 	if (pid == 0)
 		command_shell("false", "command shell fail test");
-	ret = subproc_wait_check(pid, "command shell fail test", PROCNOERR);
+	ret = subproc_reap(pid, "command shell fail test", PROCNOERR);
 	test_fail(ret == 0);
 
 	unsetenv("SHELL");
 	pid = subproc_fork();
 	if (pid == 0)
 		command_shell("true", "command default shell test");
-	ret = subproc_wait_check(pid, "command default shell test", 0);
+	ret = subproc_reap(pid, "command default shell test", 0);
 	test_pass(ret == 0);
 }
 

+ 6 - 6
lib/dpkg/test/t-subproc.c

@@ -41,38 +41,38 @@ test_subproc_fork(void)
 	pid = subproc_fork();
 	if (pid == 0)
 		exit(0);
-	ret = subproc_wait_check(pid, "subproc exit pass", PROCNOERR);
+	ret = subproc_reap(pid, "subproc exit pass", PROCNOERR);
 	test_pass(ret == 0);
 
 	pid = subproc_fork();
 	if (pid == 0)
 		exit(128);
-	ret = subproc_wait_check(pid, "subproc exit fail", PROCNOERR);
+	ret = subproc_reap(pid, "subproc exit fail", PROCNOERR);
 	test_pass(ret == 128);
 
 	/* Test signals. */
 	pid = subproc_fork();
 	if (pid == 0)
 		raise(SIGINT);
-	ret = subproc_wait_check(pid, "subproc signal", PROCWARN);
+	ret = subproc_reap(pid, "subproc signal", PROCWARN);
 	test_pass(ret == -1);
 
 	pid = subproc_fork();
 	if (pid == 0)
 		raise(SIGTERM);
-	ret = subproc_wait_check(pid, "subproc signal", PROCWARN);
+	ret = subproc_reap(pid, "subproc signal", PROCWARN);
 	test_pass(ret == -1);
 
 	pid = subproc_fork();
 	if (pid == 0)
 		raise(SIGPIPE);
-	ret = subproc_wait_check(pid, "subproc SIGPIPE", PROCWARN | PROCPIPE);
+	ret = subproc_reap(pid, "subproc SIGPIPE", PROCWARN | PROCPIPE);
 	test_pass(ret == 0);
 
 	pid = subproc_fork();
 	if (pid == 0)
 		raise(SIGPIPE);
-	ret = subproc_wait_check(pid, "subproc SIGPIPE", PROCWARN);
+	ret = subproc_reap(pid, "subproc SIGPIPE", PROCWARN);
 	test_pass(ret == -1);
 }
 

+ 1 - 1
src/archives.c

@@ -1616,7 +1616,7 @@ archivefiles(const char *const *argv)
     }
     if (ferror(pf)) ohshite(_("error reading find's pipe"));
     if (fclose(pf)) ohshite(_("error closing find's pipe"));
-    rc = subproc_wait_check(pid, "find", PROCNOERR);
+    rc = subproc_reap(pid, "find", PROCNOERR);
     if (rc != 0)
       ohshit(_("find for --recursive returned unhandled error %i"), rc);
 

+ 2 - 2
src/configure.c

@@ -212,7 +212,7 @@ show_diff(const char *old, const char *new)
 	}
 
 	/* Parent process. */
-	subproc_wait_check(pid, _("conffile difference visualizer"), PROCNOCHECK);
+	subproc_reap(pid, _("conffile difference visualizer"), PROCNOCHECK);
 }
 
 /**
@@ -242,7 +242,7 @@ spawn_shell(const char *confold, const char *confnew)
 	}
 
 	/* Parent process. */
-	subproc_wait_check(pid, _("conffile shell"), PROCNOCHECK);
+	subproc_reap(pid, _("conffile shell"), PROCNOCHECK);
 }
 
 /**

+ 1 - 1
src/help.c

@@ -393,7 +393,7 @@ void ensure_pathname_nonexisting(const char *pathname) {
   }
   debug(dbg_eachfile, "ensure_pathname_nonexisting running rm -rf '%s'",
         pathname);
-  subproc_wait_check(pid, "rm cleanup", 0);
+  subproc_reap(pid, "rm cleanup", 0);
 }
 
 void

+ 1 - 1
src/script.c

@@ -184,7 +184,7 @@ maintscript_exec(struct pkginfo *pkg, struct pkgbin *pkgbin,
 		command_exec(cmd);
 	}
 	subproc_signals_setup(cmd->name); /* This does a push_cleanup(). */
-	rc = subproc_wait_check(pid, cmd->name, warn);
+	rc = subproc_reap(pid, cmd->name, warn);
 	pop_cleanup(ehflag_normaltidy);
 
 	pop_cleanup(ehflag_normaltidy);

+ 4 - 4
src/unpack.c

@@ -103,7 +103,7 @@ deb_reassemble(const char **filename, const char **pfilename)
     ohshite(_("unable to execute %s (%s)"),
             _("split package reassembly"), SPLITTER);
   }
-  status = subproc_wait_check(pid, SPLITTER, PROCNOERR);
+  status = subproc_reap(pid, SPLITTER, PROCNOERR);
   switch (status) {
   case 0:
     /* It was a part - is it complete? */
@@ -145,7 +145,7 @@ deb_verify(const char *filename)
   } else {
     int status;
 
-    status = subproc_wait_check(pid, "debsig-verify", PROCNOCHECK);
+    status = subproc_reap(pid, "debsig-verify", PROCNOCHECK);
     if (!(WIFEXITED(status) && WEXITSTATUS(status) == 0)) {
       if (!fc_badverify)
         ohshit(_("verification on package %s failed!"), filename);
@@ -565,7 +565,7 @@ void process_archive(const char *filename) {
     ohshite(_("unable to execute %s (%s)"),
             _("package control information extraction"), BACKEND);
   }
-  subproc_wait_check(pid, BACKEND " --control", 0);
+  subproc_reap(pid, BACKEND " --control", 0);
 
   /* We want to guarantee the extracted files are on the disk, so that the
    * subsequent renames to the info database do not end up with old or zero
@@ -978,7 +978,7 @@ void process_archive(const char *filename) {
     ohshit(_("cannot zap possible trailing zeros from dpkg-deb: %s"), err.str);
   close(p1[0]);
   p1[0] = -1;
-  subproc_wait_check(pid, BACKEND " --fsys-tarfile", PROCPIPE);
+  subproc_reap(pid, BACKEND " --fsys-tarfile", PROCPIPE);
 
   tar_deferred_extract(newfileslist, pkg);