1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-06 17:18:29 +03:00

debug: fix sscanf type

Last commit c38b668fc3 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.
This commit is contained in:
Zdenek Kabelac 2023-07-13 21:19:48 +02:00
parent 6e3b51681f
commit cb2d32bdc4

View File

@ -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);