forked from Mirrors/btrfs-progs
btrfs-progs: mkfs: fix overwritten return value for mkfs
For mkfs failure, especially --rootdir errors like EPERM/ENOSPC, the out branch will overwrite the return value, causing wrong status code. Signed-off-by: Qu Wenruo <wqu@suse.com> Reviewed-by: Nikolay Borisov <nborisov@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>master
parent
a00bfc200c
commit
625223903e
|
@ -1426,6 +1426,7 @@ int main(int argc, char **argv)
|
||||||
int zero_end = 1;
|
int zero_end = 1;
|
||||||
int fd = -1;
|
int fd = -1;
|
||||||
int ret;
|
int ret;
|
||||||
|
int close_ret;
|
||||||
int i;
|
int i;
|
||||||
int mixed = 0;
|
int mixed = 0;
|
||||||
int nodesize_forced = 0;
|
int nodesize_forced = 0;
|
||||||
|
@ -1941,9 +1942,9 @@ raid_groups:
|
||||||
*/
|
*/
|
||||||
fs_info->finalize_on_close = 1;
|
fs_info->finalize_on_close = 1;
|
||||||
out:
|
out:
|
||||||
ret = close_ctree(root);
|
close_ret = close_ctree(root);
|
||||||
|
|
||||||
if (!ret) {
|
if (!close_ret) {
|
||||||
optind = saved_optind;
|
optind = saved_optind;
|
||||||
dev_cnt = argc - optind;
|
dev_cnt = argc - optind;
|
||||||
while (dev_cnt-- > 0) {
|
while (dev_cnt-- > 0) {
|
||||||
|
|
Loading…
Reference in New Issue