[PATCH] dpkg: create_list: zero terminate list in loop

Peter Korsgaard jacmet at uclibc.org
Fri Jun 6 01:10:10 PDT 2008


>>>>> "Bernhard" == Bernhard Fischer <rep.dot.nop at gmail.com> writes:

Hi,

 >> while ((line = xmalloc_fgetline(list_stream)) != NULL) {
 >> file_list = xrealloc(file_list, sizeof(char *) * (count + 2));
 >> -		file_list[count] = line;
 >> -		count++;
 >> +		file_list[count++] = line;
 >> +		file_list[count] = NULL;
 >> }
 >> fclose(list_stream);

 Bernhard> Only seeing these lines i wonder if create_list() shouldn't
 Bernhard> really just be replaced by xmalloc_xopen_read_close() ?

Unfortunately not, dpkg needs an array of line pointers, not the file
contents as a single blob.

-- 
Bye, Peter Korsgaard


More information about the busybox mailing list