aboutsummaryrefslogtreecommitdiffstats
path: root/strtotimeval.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 /strtotimeval.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 'strtotimeval.c')
-rw-r--r--strtotimeval.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/strtotimeval.c b/strtotimeval.c
index 4df5674..a0a18b9 100644
--- a/strtotimeval.c
+++ b/strtotimeval.c
@@ -9,5 +9,7 @@ libsimple_strtotimeval(struct timeval *restrict tv, const char *restrict s, char
int r = libsimple_strtotimespec(&ts, s, end);
if (r && errno != ERANGE)
return r;
- return r | libsimple_timespec2timeval(tv, &ts);
+ if (libsimple_timespec2timeval(tv, &ts) && r)
+ errno = ERANGE;
+ return r;
}