diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/testutil.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/tests/testutil.c b/tests/testutil.c index 7068e394..ce9978ce 100644 --- a/tests/testutil.c +++ b/tests/testutil.c @@ -267,7 +267,10 @@ testutil_next_port(void) (void) UnlockFileEx(h, 0, MAXDWORD, MAXDWORD, &olp); #else fseek(f, 0, SEEK_SET); - (void) ftruncate(fileno(f), 0); + if (ftruncate(fileno(f), 0) != 0) { + (void) fclose(f); + return (0); + } (void) fprintf(f, "%u", port); (void) lockf(fileno(f), 0, F_ULOCK); |
