Skip to content

Commit

Permalink
sam: show error message on failed write
Browse files Browse the repository at this point in the history
  • Loading branch information
eworm-de committed Oct 5, 2016
1 parent 5aa0a68 commit f44d8a0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions sam.c
Original file line number Diff line number Diff line change
Expand Up @@ -1111,8 +1111,10 @@ static bool cmd_write(Vis *vis, Win *win, Command *cmd, const char *argv[], Curs
}

TextSave *ctx = text_save_begin(text, *name);
if (!ctx)
if (!ctx) {
vis_info_show(vis, "Can't write `%s': %s", *name, strerror(errno));
return false;
}

bool failure = false;

Expand All @@ -1134,7 +1136,7 @@ static bool cmd_write(Vis *vis, Win *win, Command *cmd, const char *argv[], Curs
}

if (failure || !text_save_commit(ctx)) {
vis_info_show(vis, "Can't write `%s'", *name);
vis_info_show(vis, "Can't write `%s': %s", *name, strerror(errno));
return false;
}

Expand Down

0 comments on commit f44d8a0

Please sign in to comment.