aboutsummaryrefslogtreecommitdiffstats
path: root/sumtimeval.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2018-08-26 20:55:48 +0200
committerMattias Andrée <maandree@kth.se>2018-08-26 20:55:48 +0200
commit779ccf8c11d3990052f3e0f400319dbb8c2d7f77 (patch)
treecc75a0a1a1b20a78d9a70f285978e50341b3fa39 /sumtimeval.c
parentAdd test for putenvf (diff)
downloadlibsimple-779ccf8c11d3990052f3e0f400319dbb8c2d7f77.tar.gz
libsimple-779ccf8c11d3990052f3e0f400319dbb8c2d7f77.tar.bz2
libsimple-779ccf8c11d3990052f3e0f400319dbb8c2d7f77.tar.xz
Fixes and tests
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
-rw-r--r--sumtimeval.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sumtimeval.c b/sumtimeval.c
index b4e80bb..47ef705 100644
--- a/sumtimeval.c
+++ b/sumtimeval.c
@@ -13,7 +13,9 @@ libsimple_sumtimeval(struct timeval *sum, const struct timeval *augend, const st
r = libsimple_sumtimespec(&s, &a, &b);
if (r && errno != ERANGE)
return r;
- return r | libsimple_timespec2timeval(sum, &s);
+ if (libsimple_timespec2timeval(sum, &s) && r)
+ errno = ERANGE;
+ return r;
}