From: Karel Zak Date: Mon, 5 Jan 2015 11:53:50 +0000 (+0100) Subject: cfdisk: improve Dump dialog X-Git-Tag: v2.26-rc1~107 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8c9615a99b730e49c5576dc23a1f5c0e7c0ef725;p=thirdparty%2Futil-linux.git cfdisk: improve Dump dialog Signed-off-by: Karel Zak --- diff --git a/disk-utils/cfdisk.c b/disk-utils/cfdisk.c index ad72334e1e..324f56bbf5 100644 --- a/disk-utils/cfdisk.c +++ b/disk-utils/cfdisk.c @@ -1698,16 +1698,20 @@ static int ui_script_write(struct cfdisk *cf) goto done; } + DBG(UI, ul_debug("writing dump into: '%s'", buf)); f = fopen(buf, "w"); if (!f) { ui_warn(_("Cannot open: %s"), buf); + rc = -errno; goto done; } rc = fdisk_script_write_file(sc, f); + if (!rc) + ui_info(_("Disk layout successfully dumped.")); +done: if (rc) ui_warn(_("Failed to write script %s"), buf); -done: if (f) fclose(f); fdisk_unref_script(sc); @@ -1997,14 +2001,7 @@ static int main_menu_action(struct cfdisk *cf, int key) } break; case 'u': - rc = ui_script_write(cf); - if (rc == 0) - info = _("Disk layout successfully dumped."); - else if (rc != CFDISK_ERR_ESC) { - refresh(); - sleep(2); - warn = _("Failed to create script file"); - } + ui_script_write(cf); break; case 'W': /* Write */ {