summaryrefslogtreecommitdiff
path: root/extras/collect/collect.c
diff options
context:
space:
mode:
authorXinwei Hu <hxinwei@gmail.com>2008-05-27 19:35:03 +0200
committerKay Sievers <kay.sievers@vrfy.org>2008-05-27 19:35:03 +0200
commitb5254b42032b39e393f5c89102ca71c2b3fa0d11 (patch)
tree2bfbacf5e1a9a0da3f0317fb574b10c449d5826a /extras/collect/collect.c
parent2aae673c967a16276c85726975cade2413b5307b (diff)
collect: realloc buffer, if needed
Diffstat (limited to 'extras/collect/collect.c')
-rw-r--r--extras/collect/collect.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/extras/collect/collect.c b/extras/collect/collect.c
index 0a852f2db2..feb0e75768 100644
--- a/extras/collect/collect.c
+++ b/extras/collect/collect.c
@@ -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));
}
}