cfdisk: check writing to a file was successful

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
Sami Kerola 2013-04-13 20:54:38 +01:00 committed by Karel Zak
parent af6d266307
commit 1d3762ee53
1 changed files with 15 additions and 3 deletions

View File

@ -1849,7 +1849,11 @@ print_raw_table(void) {
if (to_file) {
if (!print_only)
fclose(fp);
if (close_stream(fp) != 0) {
char errstr[LINE_LENGTH];
snprintf(errstr, sizeof(errstr), _("write failed: %s"), fname);
print_warning(errstr);
}
} else {
menuContinue();
}
@ -1966,7 +1970,11 @@ print_p_info(void) {
if (to_file) {
if (!print_only)
fclose(fp);
if (close_stream(fp) != 0) {
char errstr[LINE_LENGTH];
snprintf(errstr, sizeof(errstr), _("write failed: %s"), fname);
print_warning(errstr);
}
} else {
menuContinue();
}
@ -2060,7 +2068,11 @@ print_part_table(void) {
if (to_file) {
if (!print_only)
fclose(fp);
if (close_stream(fp) != 0) {
char errstr[LINE_LENGTH];
snprintf(errstr, sizeof(errstr), _("write failed: %s"), fname);
print_warning(errstr);
}
} else {
menuContinue();
}