From b1064dda7981b58cdaefcb631e8e4dfaa010fae8 Mon Sep 17 00:00:00 2001 From: Craig Leres Date: Tue, 24 May 1983 23:30:16 -0800 Subject: [PATCH] Changed various fopens to open read/write to avoid trashing files when the file system gets full, etc. SCCS-vsn: usr.bin/mail/quit.c 2.5 --- usr/src/usr.bin/mail/quit.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/usr/src/usr.bin/mail/quit.c b/usr/src/usr.bin/mail/quit.c index 4006bf4301..10bd7176d5 100644 --- a/usr/src/usr.bin/mail/quit.c +++ b/usr/src/usr.bin/mail/quit.c @@ -9,7 +9,7 @@ * Termination processing. */ -static char *SccsId = "@(#)quit.c 2.4 %G%"; +static char *SccsId = "@(#)quit.c 2.5 %G%"; /* * Save all of the undetermined messages at the top of "mbox" @@ -177,7 +177,7 @@ quit() } fclose(obuf); close(creat(mbox, 0600)); - if ((obuf = fopen(mbox, "w")) == NULL) { + if ((obuf = fopen(mbox, "r+")) == NULL) { perror(mbox); fclose(ibuf); unlock(); @@ -248,7 +248,7 @@ quit() cream: if (rbuf != NULL) { - fbuf = fopen(mailname, "w"); + fbuf = fopen(mailname, "r+"); if (fbuf == NULL) goto newmail; while ((c = getc(rbuf)) != EOF) @@ -282,7 +282,7 @@ writeback(res) FILE *obuf; p = 0; - if ((obuf = fopen(mailname, "w")) == NULL) { + if ((obuf = fopen(mailname, "r+")) == NULL) { perror(mailname); return(-1); } -- 2.20.1