Ver código fonte

dpkg: Fix the support for passing more than one --status-fd option

Until now only the last one was being used.
Guillem Jover 18 anos atrás
pai
commit
d0e1e07ca8
3 arquivos alterados com 12 adições e 10 exclusões
  1. 4 0
      ChangeLog
  2. 2 0
      debian/changelog
  3. 6 10
      src/main.c

+ 4 - 0
ChangeLog

@@ -1,3 +1,7 @@
+2008-06-04  Guillem Jover  <guillem@debian.org>
+
+	* src/main.c (setpipe): Fix the setting of more than one pipef.
+
 2008-06-04  Guillem Jover  <guillem@debian.org>
 
 	* src/select.c (setselections): Free varbuf variables.

+ 2 - 0
debian/changelog

@@ -12,6 +12,8 @@ dpkg (1.15.0) UNRELEASED; urgency=low
   * Remove duplicate program name from dpkg-trigger badusage output.
   * Trim trailing slash and slash dot from 'dpkg -S' arguments when those
     are path names, but not on patterns. Closes: #129577
+  * Fix the support for passing more than one --status-fd option to dpkg.
+    Until now only the last one was being used.
 
   [ Raphael Hertzog ]
   * Enhance dpkg-shlibdeps's error message when a library can't be found to

+ 6 - 10
src/main.c

@@ -291,7 +291,8 @@ static void setinteger(const struct cmdinfo *cip, const char *value) {
 }
 
 static void setpipe(const struct cmdinfo *cip, const char *value) {
-  static struct pipef **lastpipe;
+  struct pipef **pipe_head = cip->parg;
+  struct pipef *pipe_new;
   unsigned long v;
   char *ep;
 
@@ -299,15 +300,10 @@ static void setpipe(const struct cmdinfo *cip, const char *value) {
   if (*ep || v > INT_MAX)
     badusage(_("invalid integer for --%s: `%.250s'"),cip->olong,value);
 
-  lastpipe= cip->parg;
-  if (*lastpipe) {
-    (*lastpipe)->next= nfmalloc(sizeof(struct pipef));
-    *lastpipe= (*lastpipe)->next;
-  } else {
-    *lastpipe= nfmalloc(sizeof(struct pipef));
-  }
-  (*lastpipe)->fd= v;
-  (*lastpipe)->next= NULL;
+  pipe_new = nfmalloc(sizeof(struct pipef));
+  pipe_new->fd = v;
+  pipe_new->next = *pipe_head;
+  *pipe_head = pipe_new;
 }
 
 static void setforce(const struct cmdinfo *cip, const char *value) {