]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
fsck, libblkid: fix printf format string issue [coverity scan]
authorSami Kerola <kerolasa@iki.fi>
Sun, 9 Aug 2020 11:59:38 +0000 (12:59 +0100)
committerKarel Zak <kzak@redhat.com>
Fri, 16 Oct 2020 09:35:16 +0000 (11:35 +0200)
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>
disk-utils/fsck.c
libblkid/src/verify.c

index fda80a6fe85be0c6fe3e8ec9f7ddb1cf8d5ca754..ec0e374a04fcbb2a330fdc8e4e1b5b7de2143f97 100644 (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;
 }
 
index 4bda3fd40ceefe3a3063b88407625a1a526a1bd9..db38623732e6c7887e77701f88509bff9ffdf6be 100644 (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;
        }