source: trunk/debathena/third/nmh/nmh-mbx_close.dpatch @ 24698

Revision 24698, 2.1 KB checked in by geofft, 14 years ago (diff)
Debathenify upstream nmh to restore r14162 (Trac: #74).
Line 
1#! /bin/sh /usr/share/dpatch/dpatch-run
2# Subject: Avoid losing mail when close() fails.
3# Origin: http://debathena.mit.edu/trac/changeset/14162
4# Forwarded: no
5# Author: Robert Basch <rbasch@mit.edu>
6# Reviewed-by: Mitchell Berger <mitchb@mit.edu>
7# Reveiwed-by: Geoffrey Thomas <geofft@mit.edu>
8
9@DPATCH@
10
11diff -ur nmh-1.3.orig/uip/dropsbr.c nmh-1.3/uip/dropsbr.c
12--- nmh-1.3.orig/uip/dropsbr.c  2008-04-05 14:41:38.000000000 -0400
13+++ nmh-1.3/uip/dropsbr.c       2010-02-08 04:38:54.000000000 -0500
14@@ -469,8 +469,7 @@
15 int
16 mbx_close (char *mailbox, int md)
17 {
18-    lkclose (md, mailbox);
19-    return OK;
20+    return (lkclose (md, mailbox) == 0 ? OK : NOTOK);
21 }
22 
23 
24@@ -643,7 +642,8 @@
25        return NOTOK;
26     }
27 
28-    mbx_close (file, fd);
29+    if (mbx_close (file, fd) == NOTOK)
30+       return NOTOK;
31 
32     return OK;
33 }
34diff -ur nmh-1.3.orig/uip/inc.c nmh-1.3/uip/inc.c
35--- nmh-1.3.orig/uip/inc.c      2007-11-04 06:54:34.000000000 -0500
36+++ nmh-1.3/uip/inc.c   2010-02-08 04:38:54.000000000 -0500
37@@ -781,7 +781,8 @@
38        if (pop_quit () == NOTOK)
39            adios (NULL, "%s", response);
40        if (packfile) {
41-           mbx_close (packfile, pd);
42+           if (mbx_close (packfile, pd) == NOTOK)
43+               adios (packfile, "error writing to file");
44            pd = NOTOK;
45        }
46     }
47diff -ur nmh-1.3.orig/uip/packf.c nmh-1.3/uip/packf.c
48--- nmh-1.3.orig/uip/packf.c    2007-11-04 06:54:35.000000000 -0500
49+++ nmh-1.3/uip/packf.c 2010-02-08 04:38:54.000000000 -0500
50@@ -171,7 +171,8 @@
51        }
52 
53     /* close and unlock maildrop file */
54-    mbx_close (file, md);
55+    if (mbx_close (file, md) == NOTOK)
56+       adios (file, "error writing to file");
57 
58     context_replace (pfolder, folder); /* update current folder         */
59     if (mp->hghsel != mp->curmsg)
60diff -ur nmh-1.3.orig/uip/slocal.c nmh-1.3/uip/slocal.c
61--- nmh-1.3.orig/uip/slocal.c   2008-04-11 10:12:55.000000000 -0400
62+++ nmh-1.3/uip/slocal.c        2010-02-08 04:38:54.000000000 -0500
63@@ -1067,7 +1067,11 @@
64     }
65 
66     /* close and unlock file */
67-    mbx_close (mailbox, md);
68+    if (mbx_close (mailbox, md) == NOTOK) {
69+       if (verbose)
70+           adorn ("", "error writing to:");
71+       return -1;
72+    }
73 
74     if (verbose)
75        verbose_printf (", success.\n");
Note: See TracBrowser for help on using the repository browser.