]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
mkfs.cramfs: Add -p padding only once
authorTobias Stoeckmann <tobias@stoeckmann.org>
Wed, 22 Apr 2026 19:14:45 +0000 (21:14 +0200)
committerTobias Stoeckmann <tobias@stoeckmann.org>
Wed, 22 Apr 2026 19:38:18 +0000 (21:38 +0200)
If -p is supplied multiple times, the estimated filesystem size is
increased multiple times as well, even though padding will happen only
once.

Increase fslen_ub only once.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
disk-utils/mkfs.cramfs.c

index 13c93e3a433d9194f9cd7e69ab5f68cd7aa3a134..f99e8d995cd85ed1f67238f0f2cb0380ce086aad 100644 (file)
@@ -779,7 +779,6 @@ int main(int argc, char **argv)
                        break;
                case 'p':
                        opt_pad = PAD_SIZE;
-                       fslen_ub += PAD_SIZE;
                        break;
                case 's':
                        /* old option, ignored */
@@ -804,6 +803,8 @@ int main(int argc, char **argv)
        dirname = argv[optind];
        outfile = argv[optind + 1];
 
+       fslen_ub += opt_pad;
+
        if (blksize == 0)
                blksize = getpagesize();