Ver código fonte

libdpkg, dpkg: Switch subproc_wait() calls to subproc_wait_check()

Add a new PROCNOCHECK flag to disable the checks and to make both calls
equivalent.
Guillem Jover 12 anos atrás
pai
commit
398875d07d
5 arquivos alterados com 12 adições e 6 exclusões
  1. 1 1
      lib/dpkg/file.c
  2. 7 2
      lib/dpkg/subproc.c
  3. 1 0
      lib/dpkg/subproc.h
  4. 2 2
      src/configure.c
  5. 1 1
      src/unpack.c

+ 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(pid, _("showing file on pager"));
+	subproc_wait_check(pid, _("showing file on pager"), PROCNOCHECK);
 }

+ 7 - 2
lib/dpkg/subproc.c

@@ -157,9 +157,14 @@ subproc_wait(pid_t pid, const char *desc)
 int
 subproc_wait_check(pid_t pid, const char *desc, int flags)
 {
-	int status;
+	int status, rc;
 
 	status = subproc_wait(pid, desc);
 
-	return subproc_check(status, desc, flags);
+	if (flags & PROCNOCHECK)
+		rc = status;
+	else
+		rc = subproc_check(status, desc, flags);
+
+	return rc;
 }

+ 1 - 0
lib/dpkg/subproc.h

@@ -39,6 +39,7 @@ void subproc_signals_cleanup(int argc, void **argv);
 #define PROCPIPE 1
 #define PROCWARN 2
 #define PROCNOERR 4
+#define PROCNOCHECK 8
 
 pid_t subproc_fork(void);
 int subproc_wait(pid_t pid, const char *desc);

+ 2 - 2
src/configure.c

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

+ 1 - 1
src/unpack.c

@@ -145,7 +145,7 @@ deb_verify(const char *filename)
   } else {
     int status;
 
-    status = subproc_wait(pid, "debsig-verify");
+    status = subproc_wait_check(pid, "debsig-verify", PROCNOCHECK);
     if (!(WIFEXITED(status) && WEXITSTATUS(status) == 0)) {
       if (!fc_badverify)
         ohshit(_("verification on package %s failed!"), filename);