- r = command (NULL, &err, "/sbin/resize2fs", device, NULL);
+ char prog[] = "mke2fs";
+ if (e2prog (prog) == -1)
+ return -1;
+
+ if (strlen (label) > EXT2_LABEL_MAX) {
+ reply_with_error ("%s: ext2 labels are limited to %d bytes",
+ label, EXT2_LABEL_MAX);
+ return -1;
+ }
+
+ char blocksize_s[32];
+ snprintf (blocksize_s, sizeof blocksize_s, "%d", blocksize);
+
+ int len = strlen (label);
+ char jdev[len+32];
+ snprintf (jdev, len+32, "device=LABEL=%s", label);
+
+ r = command (NULL, &err,
+ prog, "-t", fstype, "-J", jdev, "-b", blocksize_s,
+ device, NULL);