Skip to content

Commit 74dbffb

Browse files
committed
series/values: restore parsetime() fix after proving test coverage
1 parent 185f55e commit 74dbffb

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

src/libpcp_web/src/query.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6333,11 +6333,12 @@ static void
63336333
parsetime(seriesQueryBaton *baton, sds string, struct timespec *result, const char *source)
63346334
{
63356335
struct timespec start = { 0, 0 };
6336-
struct timespec end = { PM_MAX_TIME_T, 0 };
6336+
struct timespec end; /* wall clock — enables negative-relative branch */
63376337
char *error;
63386338
sds msg;
63396339
int sts;
63406340

6341+
pmtimespecNow(&end);
63416342
if ((sts = __pmtimespecParse(string, &start, &end, result, &error)) < 0) {
63426343
msg = NULL;
63436344
infofmt(msg, "Cannot parse time %s with %s:\n%s",
@@ -6484,6 +6485,12 @@ pmSeriesValues(pmSeriesSettings *settings, pmSeriesTimeWindow *timing,
64846485
return -ENOMEM;
64856486
initSeriesQueryBaton(baton, settings, arg);
64866487
initSeriesGetValues(baton, nseries, series, timing);
6488+
if (baton->error) {
6489+
/* parse error or alloc failure — abort before launching async phases */
6490+
int sts = baton->error;
6491+
series_query_finished(baton);
6492+
return sts;
6493+
}
64876494

64886495
baton->current = &baton->phases[0];
64896496
baton->phases[i++].func = series_lookup_services;

0 commit comments

Comments
 (0)