1 $NetBSD: patch-ag,v 1.2 2012/02/22 21:01:53 shattered Exp $
3 --- decode.c.orig 2003-07-21 20:47:54.000000000 +0000
6 * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
13 @@ -545,8 +546,8 @@ getDispositionFilename(char *disposition
14 SkipWhitespace(&disposition);
15 if (!disposition) return 0;
17 - /* If we're looking at a ";", we found what we're looking for */
18 - if (*disposition++ == ';') break;
19 + /* If we're looking at a "=", we found what we're looking for */
20 + if (*disposition++ == '=') break;
23 SkipWhitespace(&disposition);
24 @@ -601,7 +602,7 @@ int handlePartial(struct part *inpart, c
29 + int nparts = 0, onparts=0;
31 FILE *partfile, *outfile;
33 @@ -624,33 +625,44 @@ int handlePartial(struct part *inpart, c
37 + /* Try to retrieve number of parts from reassembly directory */
38 + sprintf(buf, "%sCT", dir);
39 + if (partfile = fopen(buf, "r")) {
40 + if (fgets(buf, sizeof(buf), partfile)) {
41 + onparts = atoi(buf);
42 + if (onparts < 0) onparts = 0;
47 if (p = getParam(contentParams, "total")) {
50 warn("partial message has invalid number of parts");
53 - /* Store number of parts in reassembly directory */
54 - sprintf(buf, "%sCT", dir);
55 - partfile = os_createnewfile(buf);
58 + if (onparts && nparts && nparts != onparts) {
59 + warn("messages disagree about total number of parts");
62 - fprintf(partfile, "%d\n", nparts);
66 - /* Try to retrieve number of parts from reassembly directory */
68 + /* Store number of parts in reassembly directory */
69 sprintf(buf, "%sCT", dir);
70 - if (partfile = fopen(buf, "r")) {
71 - if (fgets(buf, sizeof(buf), partfile)) {
73 - if (nparts < 0) nparts = 0;
74 + partfile = fopen(buf, "w");
76 + if (errno != EEXIST) {
82 + fprintf(partfile, "%d\n", nparts);
91 if (thispart <= 0 || (nparts && thispart > nparts)) {