Explorar el Código

dpkg: Only copy already counted output lines from find

Instead of appending two NUL characters to be able to track the end of
the NUL terminated lines from find's output. Just handle the number of
lines we have already counted previously.
Guillem Jover hace 15 años
padre
commit
280ac914cc
Se han modificado 1 ficheros con 3 adiciones y 6 borrados
  1. 3 6
      src/archives.c

+ 3 - 6
src/archives.c

@@ -4,7 +4,7 @@
  *
  * Copyright © 1994,1995 Ian Jackson <ian@chiark.greenend.org.uk>
  * Copyright © 2000 Wichert Akkerman <wakkerma@debian.org>
- * Copyright © 2007-2010 Guillem Jover <guillem@debian.org>
+ * Copyright © 2007-2011 Guillem Jover <guillem@debian.org>
  *
  * This is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -1245,12 +1245,9 @@ void archivefiles(const char *const *argv) {
     if (!nfiles)
       ohshit(_("searched, but found no packages (files matching *.deb)"));
 
-    varbuf_add_char(&findoutput, '\0');
-    varbuf_add_char(&findoutput, '\0');
-
     arglist= m_malloc(sizeof(char*)*(nfiles+1));
-    p= findoutput.buf; i=0;
-    while (*p) {
+    p = findoutput.buf;
+    for (i = 0; i < nfiles; i++) {
       arglist[i++]= p;
       while (*p++ != '\0') ;
     }