summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--text-utils/pg.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/text-utils/pg.c b/text-utils/pg.c
index c00b7371..7ddf96bf 100644
--- a/text-utils/pg.c
+++ b/text-utils/pg.c
@@ -1228,7 +1228,14 @@ static void pgfile(FILE *f, const char *name)
/* No error check for compat. */
fwrite_all(b, sizeof *b, sz, save);
}
- fclose(save);
+ if (close_stream(save) != 0) {
+ cmd.count = errno;
+ mesg(_("write failed"));
+ mesg(": ");
+ mesg(p);
+ mesg(strerror(cmd.count));
+ goto newcmd;
+ }
fseeko(fbuf, (off_t)0, SEEK_END);
mesg(_("saved"));
goto newcmd;