From cb2d32bdc4ff0e28a8ab13ac64bf6461296ac966 Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Thu, 13 Jul 2023 21:19:48 +0200 Subject: [PATCH] debug: fix sscanf type Last commit c38b668fc3ead664a35130c1acec63518630d1dc was pushed with type 'scanf' instead of 'sscanf' needed for buffer reading. Interestingly this caused scanning from 'stdin' descriptor and thus failures in lvm shell usage. --- lib/log/log.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/log/log.c b/lib/log/log.c index 0b79ed16d..8411b8874 100644 --- a/lib/log/log.c +++ b/lib/log/log.c @@ -244,11 +244,11 @@ static int _get_pid_starttime(int *pid, unsigned long long *starttime) if ((sscanf(buf, "%d ", pid) == 1) && /* Jump past COMM, don't use scanf with '%s' since COMM may contain a space. */ (p = strrchr(buf, ')')) && - (scanf(++p, " %*c %*d %*d %*d %*d " /* tty_nr */ - "%*d %*u %*u %*u %*u " /* mjflt */ - "%*u %*u %*u %*d %*d " /* cstim */ - "%*d %*d %*d %*d " /* itrealvalue */ - "%llu", &starttime) == 1)) + (sscanf(++p, " %*c %*d %*d %*d %*d " /* tty_nr */ + "%*d %*u %*u %*u %*u " /* mjflt */ + "%*u %*u %*u %*d %*d " /* cstim */ + "%*d %*d %*d %*d " /* itrealvalue */ + "%llu", &starttime) == 1)) return 1; log_debug("Cannot parse content of %s.", statfile);