}
else if(pid>0)
{
- char buf[256];
+ char *buf;
+ int bufsize;
int pos = 0;
int eof = 0;
Property *props = NULL;
close(pipe_fd[1]);
+ bufsize = 256;
+ buf = (char *)malloc(bufsize);
+
while(1)
{
int newline;
{
int len;
- len = read(pipe_fd[0], buf+pos, sizeof(buf)-pos);
+ len = read(pipe_fd[0], buf+pos, bufsize-pos);
if(len==0)
eof = 1;
else if(len==-1)
newline = i;
if(newline<0)
- break;
+ {
+ if(eof)
+ break;
+ bufsize *= 2;
+ buf = (char *)realloc(buf, bufsize);
+ continue;
+ }
if(parse_property(buf, newline, &prop)==0)
{
break;
}
+ free(buf);
+
if(props)
{
props[n_props].name = NULL;