From imap-2006.DEV.SNAP-0606051545:

src/c-client/newsrc::newsrc_write.c(), line 403:

---
if (fclose (f) == EOF) return newsrc_write_error (newsrc,bf,f);
---

Line 424:

---
    if ((fputs (group,f) == EOF) || ((putc (':',f)) == EOF) ||
    (!newsrc_newmessages (f,stream,nl[0] ? nl : "\n")) ||
    (fclose (f) == EOF)) return newsrc_write_error (newsrc,bf,f);
---

Implementation of newsrc_write_error():

---
long newsrc_write_error (char *name,FILE *f1,FILE *f2)
{
  fclose (f1);                  /* close file designators */
  fclose (f2);
  return newsrc_error ("Error writing to %.80s",name,ERROR);
}
---

From fclose() man page:

---
RETURN VALUE
       Upon  successful completion 0 is returned.  Otherwise, EOF is
       returned and the global variable errno is set to indicate the
       error.  In either case  any  further  access (including another
       call to fclose()) to the stream results in undefined behaviour.
---

It would probably be best then to remove the second call to fclose()
along any error path resulting from an EOF from fclose().

Mike

(found by Coverity)

Attachment: signature.asc
Description: Digital signature

_______________________________________________
Imap-uw mailing list
[email protected]
https://mailman1.u.washington.edu/mailman/listinfo/imap-uw

Reply via email to