diff options
author | Dan Fandrich <dan@coneharvesters.com> | 2005-03-05 00:54:16 +0000 |
---|---|---|
committer | Dan Fandrich <dan@coneharvesters.com> | 2005-03-05 00:54:16 +0000 |
commit | 42ac24448ca019564d03a43d9e6b465c0e8248c0 (patch) | |
tree | 1cb6d9649e03bb8c6db014b2097a2bbb427c9ae9 /src/main.c | |
parent | 31891b55a4cfb35b49093edd611fa01ed9f4df2a (diff) |
Better cope with a failed or unavailable ftruncate().
Added HAVE_FTRUNCATE to all the static config-*.h files on the assumption
that all those systems provide it.
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/main.c b/src/main.c index b37d1dae0..43e9c4939 100644 --- a/src/main.c +++ b/src/main.c @@ -3771,10 +3771,12 @@ operate(struct Configurable *config, int argc, char *argv[]) " bytes\n", outs.bytes); fflush(outs.stream); /* truncate file at the position where we started appending */ +#ifdef HAVE_FTRUNCATE ftruncate( fileno(outs.stream), outs.init); +#endif /* now seek to the end of the file, the position where we just truncated the file */ - fseek(outs.stream, 0, SEEK_END); + fseek(outs.stream, outs.init, SEEK_SET); outs.bytes = 0; /* clear for next round */ } continue; |