1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-11-01 00:51:08 +03:00

collect: realloc buffer, if needed

This commit is contained in:
Xinwei Hu 2008-05-27 19:35:03 +02:00 committed by Kay Sievers
parent 2aae673c96
commit b5254b4203

View File

@ -271,7 +271,11 @@ static int missing(int fd)
if (him->state == STATE_NONE) {
ret++;
} else {
sprintf(buf, "%s ", him->name);
while (strlen(him->name)+1 >= bufsize) {
bufsize = bufsize << 1;
buf = realloc(buf, bufsize);
}
snprintf(buf, strlen(him->name)+2, "%s ", him->name);
write(fd, buf, strlen(buf));
}
}