]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
mkswap: tell how to fix insecure permissions and owner in warning
authorSami Kerola <kerolasa@iki.fi>
Sat, 28 Nov 2020 23:02:58 +0000 (23:02 +0000)
committerSami Kerola <kerolasa@iki.fi>
Mon, 28 Dec 2020 09:53:13 +0000 (09:53 +0000)
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
disk-utils/mkswap.c

index 631e7028497f73d80c5905c08839736d901a6992..87718331bc194687ef9337d986f0760ae5e064ed 100644 (file)
@@ -587,12 +587,12 @@ int main(int argc, char **argv)
        open_device(&ctl);
        permMask = S_ISBLK(ctl.devstat.st_mode) ? 07007 : 07077;
        if ((ctl.devstat.st_mode & permMask) != 0)
-               warnx(_("%s: insecure permissions %04o, %04o suggested."),
+               warnx(_("%s: insecure permissions %04o, fix with: chmod %04o %s"),
                        ctl.devname, ctl.devstat.st_mode & 07777,
-                       ~permMask & 0666);
+                       ~permMask & 0666, ctl.devname);
        if (getuid() == 0 && S_ISREG(ctl.devstat.st_mode) && ctl.devstat.st_uid != 0)
-               warnx(_("%s: insecure file owner %d, 0 (root) suggested."),
-                       ctl.devname, ctl.devstat.st_uid);
+               warnx(_("%s: insecure file owner %d, fix with: chown 0:0 %s"),
+                       ctl.devname, ctl.devstat.st_uid, ctl.devname);
 
 
        if (ctl.check)