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:
parent
2aae673c96
commit
b5254b4203
@ -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));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user