X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Fshared%2Ftime-util.c;h=12f1b193be550aa7b3962891c99ea7fe75943b7e;hp=947ac1fcfb23075f1abd69119568fe32ebaaad3a;hb=86e97d599f8b1ca379dce64fadac9b8f6b002ac5;hpb=63c372cb9df3bee01e3bf8cd7f96f336bddda846 diff --git a/src/shared/time-util.c b/src/shared/time-util.c index 947ac1fcf..12f1b193b 100644 --- a/src/shared/time-util.c +++ b/src/shared/time-util.c @@ -398,18 +398,21 @@ void dual_timestamp_serialize(FILE *f, const char *name, dual_timestamp *t) { t->monotonic); } -void dual_timestamp_deserialize(const char *value, dual_timestamp *t) { +int dual_timestamp_deserialize(const char *value, dual_timestamp *t) { unsigned long long a, b; assert(value); assert(t); - if (sscanf(value, "%llu %llu", &a, &b) != 2) - log_debug("Failed to parse finish timestamp value %s", value); - else { - t->realtime = a; - t->monotonic = b; + if (sscanf(value, "%llu %llu", &a, &b) != 2) { + log_debug("Failed to parse finish timestamp value %s.", value); + return -EINVAL; } + + t->realtime = a; + t->monotonic = b; + + return 0; } int parse_timestamp(const char *t, usec_t *usec) { @@ -786,7 +789,7 @@ int parse_nsec(const char *t, nsec_t *nsec) { s = startswith(p, "infinity"); if (s) { s += strspn(s, WHITESPACE); - if (!*s != 0) + if (*s != 0) return -EINVAL; *nsec = NSEC_INFINITY;