return 0;
}
-#define RUN_PARTED(device,...) \
+#define RUN_PARTED(error,device,...) \
do { \
int r; \
char *err; \
if (recover_blkrrpart ((device), err) == -1) { \
reply_with_error ("%s: parted: %s: %s", __func__, (device), err); \
free (err); \
- return -1; \
+ error; \
} \
} \
\
return -1;
}
- RUN_PARTED (device, "mklabel", parttype, NULL);
+ RUN_PARTED (return -1, device, "mklabel", parttype, NULL);
udev_settle ();
* name_ to prlogex, eg. "primary". I would essentially describe
* this as a bug in the parted mkpart command.
*/
- RUN_PARTED (device, "mkpart", prlogex, startstr, endstr, NULL);
+ RUN_PARTED (return -1, device, "mkpart", prlogex, startstr, endstr, NULL);
udev_settle ();
endstr = "-1s";
}
- RUN_PARTED (device,
+ RUN_PARTED (return -1,
+ device,
"mklabel", parttype,
/* See comment about about the parted mkpart command. */
"mkpart", STREQ (parttype, "gpt") ? "p1" : "primary",
snprintf (partstr, sizeof partstr, "%d", partnum);
- RUN_PARTED (device, "set", partstr, "boot", bootable ? "on" : "off", NULL);
+ RUN_PARTED (return -1,
+ device, "set", partstr, "boot", bootable ? "on" : "off", NULL);
udev_settle ();
snprintf (partstr, sizeof partstr, "%d", partnum);
- RUN_PARTED (device, "name", partstr, name, NULL);
+ RUN_PARTED (return -1, device, "name", partstr, name, NULL);
udev_settle ();