The following commit has been merged in the master branch:
commit f754c4bc86e6927456570bbb2a5574eeba25a83d
Author: Guillem Jover <[email protected]>
Date:   Sun Dec 2 21:41:39 2012 +0100

    dpkg-deb: Switch extracthalf() to use struct command

diff --git a/dpkg-deb/extract.c b/dpkg-deb/extract.c
index ba843ca..42a0e07 100644
--- a/dpkg-deb/extract.c
+++ b/dpkg-deb/extract.c
@@ -297,11 +297,17 @@ extracthalf(const char *debar, const char *dir, const 
char *taroption,
   if (taroption) {
     c3 = subproc_fork();
     if (!c3) {
-      char buffer[30+2];
-      if (strlen(taroption) > 30)
-        internerr("taroption is too long '%s'", taroption);
-      strcpy(buffer, taroption);
-      strcat(buffer, "f");
+      struct command cmd;
+
+      command_init(&cmd, TAR, "tar");
+      command_add_arg(&cmd, "tar");
+
+      command_add_arg(&cmd, taroption);
+
+      command_add_arg(&cmd, "-f");
+      command_add_arg(&cmd, "-");
+      command_add_arg(&cmd, "--warning=no-timestamp");
+
       m_dup2(p2[0],0);
       close(p2[0]);
 
@@ -319,8 +325,7 @@ extracthalf(const char *debar, const char *dir, const char 
*taroption,
         }
       }
 
-      execlp(TAR, "tar", buffer, "-", "--warning=no-timestamp", NULL);
-      ohshite(_("unable to execute %s (%s)"), "tar", TAR);
+      command_exec(&cmd);
     }
     close(p2[0]);
     subproc_wait_check(c3, "tar", 0);

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to