]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
resize-fs: Use xsprintf instead of snprintf
authorBenjamin Robin <dev@benjarobin.fr>
Wed, 6 May 2020 20:58:24 +0000 (22:58 +0200)
committerBenjamin Robin <dev@benjarobin.fr>
Wed, 6 May 2020 21:03:25 +0000 (23:03 +0200)
src/shared/resize-fs.c

index 0abd289fecf9cf50dd3bf9b1601fa4848ac7569b..24a17a2ffef8873aae63155a1ba43c0cd7a1a22f 100644 (file)
@@ -41,7 +41,6 @@ int resize_fs(int fd, uint64_t sz, uint64_t *ret_size) {
                         *ret_size = u * sfs.f_bsize;
 
         } else if (is_fs_type(&sfs, BTRFS_SUPER_MAGIC)) {
-                _unused_ int r;
                 struct btrfs_ioctl_vol_args args = {};
 
                 /* 256M is the minimize size enforced by the btrfs kernel code when resizing (which is
@@ -54,8 +53,7 @@ int resize_fs(int fd, uint64_t sz, uint64_t *ret_size) {
 
                 sz -= sz % sfs.f_bsize;
 
-                r = snprintf(args.name, sizeof(args.name), "%" PRIu64, sz);
-                assert((size_t) r < sizeof(args.name));
+                xsprintf(args.name, "%" PRIu64, sz);
 
                 if (ioctl(fd, BTRFS_IOC_RESIZE, &args) < 0)
                         return -errno;