소스 검색

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 15 년 전
부모
커밋
280ac914cc
1개의 변경된 파일과 3개의 추가작업 그리고 6개의 파일을 삭제
  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') ;
     }