fsck, libblkid: fix printf format string issue [coverity scan]

According to coverirty a printf format string contains an unrecognized
format specifier (CWE-628).  Lets avoid glibc extension "%m" that is same
as "%s", strerror(errno).

CID: 360699
CID: 360718
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
Sami Kerola 2020-08-09 12:59:38 +01:00 committed by Karel Zak
parent 12558a4c47
commit 7f9e76b4df
2 changed files with 6 additions and 6 deletions

View File

@ -931,8 +931,8 @@ static int fsck_device(struct libmnt_fs *fs, int interactive)
}
return 0;
err:
warnx(_("error %d (%m) while executing fsck.%s for %s"),
retval, type, fs_get_device(fs));
warnx(_("error %d (%s) while executing fsck.%s for %s"),
retval, strerror(errno), type, fs_get_device(fs));
return FSCK_EX_ERROR;
}

View File

@ -73,8 +73,8 @@ blkid_dev blkid_verify(blkid_cache cache, blkid_dev dev)
diff = now - dev->bid_time;
if (stat(dev->bid_name, &st) < 0) {
DBG(PROBE, ul_debug("blkid_verify: error %m (%d) while "
"trying to stat %s", errno,
DBG(PROBE, ul_debug("blkid_verify: error %s (%d) while "
"trying to stat %s", strerror(errno), errno,
dev->bid_name));
open_err:
if ((errno == EPERM) || (errno == EACCES) || (errno == ENOENT)) {
@ -128,8 +128,8 @@ blkid_dev blkid_verify(blkid_cache cache, blkid_dev dev)
fd = open(dev->bid_name, O_RDONLY|O_CLOEXEC|O_NONBLOCK);
if (fd < 0) {
DBG(PROBE, ul_debug("blkid_verify: error %m (%d) while "
"opening %s", errno,
DBG(PROBE, ul_debug("blkid_verify: error %s (%d) while "
"opening %s", strerror(errno), errno,
dev->bid_name));
goto open_err;
}