projects
/
unix-history
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
tags
|
clone url
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
include aculib in cleanup
[unix-history]
/
usr
/
src
/
usr.bin
/
mail
/
quit.c
diff --git
a/usr/src/usr.bin/mail/quit.c
b/usr/src/usr.bin/mail/quit.c
index
330fa4f
..
f1acaec
100644
(file)
--- a/
usr/src/usr.bin/mail/quit.c
+++ b/
usr/src/usr.bin/mail/quit.c
@@
-9,7
+9,7
@@
* Termination processing.
*/
* Termination processing.
*/
-static char *SccsId = "@(#)quit.c 2.
3
%G%";
+static char *SccsId = "@(#)quit.c 2.
6
%G%";
/*
* Save all of the undetermined messages at the top of "mbox"
/*
* Save all of the undetermined messages at the top of "mbox"
@@
-177,7
+177,7
@@
quit()
}
fclose(obuf);
close(creat(mbox, 0600));
}
fclose(obuf);
close(creat(mbox, 0600));
- if ((obuf = fopen(mbox, "
w
")) == NULL) {
+ if ((obuf = fopen(mbox, "
r+
")) == NULL) {
perror(mbox);
fclose(ibuf);
unlock();
perror(mbox);
fclose(ibuf);
unlock();
@@
-192,7
+192,7
@@
quit()
}
for (mp = &message[0]; mp < &message[msgCount]; mp++)
if (mp->m_flag & MBOX)
}
for (mp = &message[0]; mp < &message[msgCount]; mp++)
if (mp->m_flag & MBOX)
- if (send(mp, obuf) < 0) {
+ if (send(mp, obuf
, 0
) < 0) {
perror(mbox);
fclose(ibuf);
fclose(obuf);
perror(mbox);
fclose(ibuf);
fclose(obuf);
@@
-218,6
+218,7
@@
quit()
fclose(ibuf);
fflush(obuf);
}
fclose(ibuf);
fflush(obuf);
}
+ trunc(obuf);
if (ferror(obuf)) {
perror(mbox);
fclose(obuf);
if (ferror(obuf)) {
perror(mbox);
fclose(obuf);
@@
-248,12
+249,13
@@
quit()
cream:
if (rbuf != NULL) {
cream:
if (rbuf != NULL) {
- fbuf = fopen(mailname, "
w
");
+ fbuf = fopen(mailname, "
r+
");
if (fbuf == NULL)
goto newmail;
while ((c = getc(rbuf)) != EOF)
putc(c, fbuf);
fclose(rbuf);
if (fbuf == NULL)
goto newmail;
while ((c = getc(rbuf)) != EOF)
putc(c, fbuf);
fclose(rbuf);
+ trunc(fbuf);
fclose(fbuf);
alter(mailname);
unlock();
fclose(fbuf);
alter(mailname);
unlock();
@@
-274,7
+276,6
@@
newmail:
* saved. On any error, just return -1. Else return 0.
* Incorporate the any new mail that we found.
*/
* saved. On any error, just return -1. Else return 0.
* Incorporate the any new mail that we found.
*/
-
writeback(res)
register FILE *res;
{
writeback(res)
register FILE *res;
{
@@
-283,7
+284,7
@@
writeback(res)
FILE *obuf;
p = 0;
FILE *obuf;
p = 0;
- if ((obuf = fopen(mailname, "
w
")) == NULL) {
+ if ((obuf = fopen(mailname, "
r+
")) == NULL) {
perror(mailname);
return(-1);
}
perror(mailname);
return(-1);
}
@@
-295,7
+296,7
@@
writeback(res)
for (mp = &message[0]; mp < &message[msgCount]; mp++)
if ((mp->m_flag&MPRESERVE)||(mp->m_flag&MTOUCH)==0) {
p++;
for (mp = &message[0]; mp < &message[msgCount]; mp++)
if ((mp->m_flag&MPRESERVE)||(mp->m_flag&MTOUCH)==0) {
p++;
- if (send(mp, obuf) < 0) {
+ if (send(mp, obuf
, 0
) < 0) {
perror(mailname);
fclose(obuf);
return(-1);
perror(mailname);
fclose(obuf);
return(-1);
@@
-307,6
+308,7
@@
writeback(res)
putc(c, obuf);
#endif
fflush(obuf);
putc(c, obuf);
#endif
fflush(obuf);
+ trunc(obuf);
if (ferror(obuf)) {
perror(mailname);
fclose(obuf);
if (ferror(obuf)) {
perror(mailname);
fclose(obuf);