aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2020-11-08 20:57:35 -0800
committerGarrett D'Amore <garrett@damore.org>2020-11-08 20:57:35 -0800
commit6cf8b299a4658a235033f77c2645b76043ff801e (patch)
tree8fc2e3eb5188057905aa35ce1974216cd424a66a /tests
parented5ae8e3d1e8d5ec9b308e94cdf311f897edd0c6 (diff)
downloadnng-6cf8b299a4658a235033f77c2645b76043ff801e.tar.gz
nng-6cf8b299a4658a235033f77c2645b76043ff801e.tar.bz2
nng-6cf8b299a4658a235033f77c2645b76043ff801e.zip
Clean up some warnings.
Diffstat (limited to 'tests')
-rw-r--r--tests/testutil.c5
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);