attribute.c mbx_unix.c
bug in *_unset_attributes and mailbox_expunge.
Showing
2 changed files
with
17 additions
and
11 deletions
... | @@ -63,7 +63,7 @@ attribute_set_answered (attribute_t attr) | ... | @@ -63,7 +63,7 @@ attribute_set_answered (attribute_t attr) |
63 | { | 63 | { |
64 | if (attr == NULL) | 64 | if (attr == NULL) |
65 | return EINVAL; | 65 | return EINVAL; |
66 | attr->flag|= MU_ATTRIBUTE_ANSWERED; | 66 | attr->flag |= MU_ATTRIBUTE_ANSWERED; |
67 | return 0; | 67 | return 0; |
68 | } | 68 | } |
69 | 69 | ||
... | @@ -173,7 +173,7 @@ attribute_unset_seen (attribute_t attr) | ... | @@ -173,7 +173,7 @@ attribute_unset_seen (attribute_t attr) |
173 | { | 173 | { |
174 | if (attr == NULL) | 174 | if (attr == NULL) |
175 | return 0; | 175 | return 0; |
176 | attr->flag ^= MU_ATTRIBUTE_SEEN; | 176 | attr->flag &= ~MU_ATTRIBUTE_SEEN; |
177 | return 0; | 177 | return 0; |
178 | } | 178 | } |
179 | 179 | ||
... | @@ -182,7 +182,7 @@ attribute_unset_answered (attribute_t attr) | ... | @@ -182,7 +182,7 @@ attribute_unset_answered (attribute_t attr) |
182 | { | 182 | { |
183 | if (attr == NULL) | 183 | if (attr == NULL) |
184 | return 0; | 184 | return 0; |
185 | attr->flag ^= MU_ATTRIBUTE_ANSWERED; | 185 | attr->flag &= ~MU_ATTRIBUTE_ANSWERED; |
186 | return 0; | 186 | return 0; |
187 | } | 187 | } |
188 | 188 | ||
... | @@ -191,7 +191,7 @@ attribute_unset_flagged (attribute_t attr) | ... | @@ -191,7 +191,7 @@ attribute_unset_flagged (attribute_t attr) |
191 | { | 191 | { |
192 | if (attr == NULL) | 192 | if (attr == NULL) |
193 | return 0; | 193 | return 0; |
194 | attr->flag ^= MU_ATTRIBUTE_FLAGGED; | 194 | attr->flag &= ~MU_ATTRIBUTE_FLAGGED; |
195 | return 0; | 195 | return 0; |
196 | } | 196 | } |
197 | 197 | ||
... | @@ -200,7 +200,7 @@ attribute_unset_read (attribute_t attr) | ... | @@ -200,7 +200,7 @@ attribute_unset_read (attribute_t attr) |
200 | { | 200 | { |
201 | if (attr == NULL) | 201 | if (attr == NULL) |
202 | return 0; | 202 | return 0; |
203 | attr->flag ^= MU_ATTRIBUTE_READ; | 203 | attr->flag &= ~MU_ATTRIBUTE_READ; |
204 | return 0; | 204 | return 0; |
205 | } | 205 | } |
206 | 206 | ||
... | @@ -209,7 +209,7 @@ attribute_unset_deleted (attribute_t attr) | ... | @@ -209,7 +209,7 @@ attribute_unset_deleted (attribute_t attr) |
209 | { | 209 | { |
210 | if (attr == NULL) | 210 | if (attr == NULL) |
211 | return 0; | 211 | return 0; |
212 | attr->flag ^= MU_ATTRIBUTE_DELETED; | 212 | attr->flag &= ~MU_ATTRIBUTE_DELETED; |
213 | return 0; | 213 | return 0; |
214 | } | 214 | } |
215 | 215 | ||
... | @@ -218,7 +218,7 @@ attribute_unset_draft (attribute_t attr) | ... | @@ -218,7 +218,7 @@ attribute_unset_draft (attribute_t attr) |
218 | { | 218 | { |
219 | if (attr == NULL) | 219 | if (attr == NULL) |
220 | return 0; | 220 | return 0; |
221 | attr->flag ^= MU_ATTRIBUTE_DRAFT; | 221 | attr->flag &= ~MU_ATTRIBUTE_DRAFT; |
222 | return 0; | 222 | return 0; |
223 | } | 223 | } |
224 | 224 | ||
... | @@ -227,7 +227,7 @@ attribute_unset_recent (attribute_t attr) | ... | @@ -227,7 +227,7 @@ attribute_unset_recent (attribute_t attr) |
227 | { | 227 | { |
228 | if (attr == NULL) | 228 | if (attr == NULL) |
229 | return 0; | 229 | return 0; |
230 | attr->flag ^= MU_ATTRIBUTE_RECENT; | 230 | attr->flag &= ~MU_ATTRIBUTE_RECENT; |
231 | return 0; | 231 | return 0; |
232 | } | 232 | } |
233 | 233 | ... | ... |
... | @@ -584,8 +584,8 @@ mailbox_unix_readhdr (mailbox_t mbox, char *buf, size_t len, | ... | @@ -584,8 +584,8 @@ mailbox_unix_readhdr (mailbox_t mbox, char *buf, size_t len, |
584 | /* Set the attribute */ | 584 | /* Set the attribute */ |
585 | else if (strncmp (buf, "Status:", 7) == 0) | 585 | else if (strncmp (buf, "Status:", 7) == 0) |
586 | { | 586 | { |
587 | mum->hdr_status = ftell (mud->file); | 587 | mum->hdr_status_end = ftell (mud->file); |
588 | mum->hdr_status_end = mum->hdr_status + strlen (buf); | 588 | mum->hdr_status = mum->hdr_status_end - strlen (buf); |
589 | sep = strchr(buf, ':'); /* pass the ':' */ | 589 | sep = strchr(buf, ':'); /* pass the ':' */ |
590 | if (strchr (sep, 'R') != NULL) | 590 | if (strchr (sep, 'R') != NULL) |
591 | attribute_set_read (mum->old_attr); | 591 | attribute_set_read (mum->old_attr); |
... | @@ -976,7 +976,7 @@ mailbox_unix_expunge (mailbox_t mbox) | ... | @@ -976,7 +976,7 @@ mailbox_unix_expunge (mailbox_t mbox) |
976 | if (attribute_is_deleted (mum->new_attr)) | 976 | if (attribute_is_deleted (mum->new_attr)) |
977 | continue; | 977 | continue; |
978 | 978 | ||
979 | /* add a NL separtor between messages */ | 979 | /* add a NL separator between messages */ |
980 | if (first) | 980 | if (first) |
981 | first = 0; | 981 | first = 0; |
982 | else | 982 | else |
... | @@ -1036,6 +1036,12 @@ mailbox_unix_expunge (mailbox_t mbox) | ... | @@ -1036,6 +1036,12 @@ mailbox_unix_expunge (mailbox_t mbox) |
1036 | fputc ('\n', tmpfile); | 1036 | fputc ('\n', tmpfile); |
1037 | total++; | 1037 | total++; |
1038 | } | 1038 | } |
1039 | /* skip the status field */ | ||
1040 | if (fseek (mud->file, current, SEEK_SET) == -1) | ||
1041 | { | ||
1042 | status = errno; | ||
1043 | goto bailout; | ||
1044 | } | ||
1039 | } | 1045 | } |
1040 | else /* attribute did not change */ | 1046 | else /* attribute did not change */ |
1041 | { | 1047 | { | ... | ... |
-
Please register or sign in to post a comment