we wipe the filesystem signatures from device before do mkfs, since we can't trust mkfs can remove the filesystem signature absolutely.
Signed-off-by: Wanlong Gao <[email protected]> --- daemon/mkfs.c | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-) diff --git a/daemon/mkfs.c b/daemon/mkfs.c index 5475582..19224ec 100644 --- a/daemon/mkfs.c +++ b/daemon/mkfs.c @@ -181,6 +181,15 @@ do_mkfs_opts (const char *fstype, const char *device, int blocksize, ADD_ARG (argv, i, device); ADD_ARG (argv, i, NULL); + /* we wipe the filesystem signatures from device before do mkfs, + * since we can't trust mkfs can remove the filesystem signature absolutely. + */ + if (do_wipefs (device)) { + reply_with_error ("%s: %s: %s", fstype, device, err); + free (err); + return -1; + } + r = commandv (NULL, &err, argv); if (r == -1) { reply_with_error ("%s: %s: %s", fstype, device, err); -- 1.7.9 _______________________________________________ Libguestfs mailing list [email protected] https://www.redhat.com/mailman/listinfo/libguestfs
