The following commit has been merged in the master branch:
commit 3f355904aa56fcb6c782d951d75bf136c3b8b81d
Author: Guillem Jover <[email protected]>
Date: Mon Feb 22 05:08:00 2010 +0100
dpkg-deb: Use subproc functions instead of ad-hoc code
This makes cu_info_prepare call ohshite in case of error, but that's
fine as the normal unwinding will happen in that case.
diff --git a/dpkg-deb/info.c b/dpkg-deb/info.c
index 7f04b98..28b576d 100644
--- a/dpkg-deb/info.c
+++ b/dpkg-deb/info.c
@@ -49,20 +49,19 @@
static void cu_info_prepare(int argc, void **argv) {
pid_t c1;
- int status;
char *directory;
struct stat stab;
directory= (char*)(argv[0]);
if (chdir("/")) { perror(_("failed to chdir to `/' for cleanup")); return; }
if (lstat(directory,&stab) && errno==ENOENT) return;
- if ((c1= fork()) == -1) { perror(_("failed to fork for cleanup")); return; }
+
+ c1 = subproc_fork();
if (!c1) {
execlp(RM, "rm", "-rf", directory, NULL);
perror(_("failed to exec rm for cleanup")); _exit(1);
}
- if (waitpid(c1,&status,0) != c1) { perror(_("failed to wait for rm
cleanup")); return; }
- if (status) { fprintf(stderr,_("rm cleanup failed, code %d\n"),status); }
+ subproc_wait_check(c1, "rm cleanup", 0);
}
static void info_prepare(const char *const **argvp,
--
dpkg's main repository
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]