List, Checking the source for dlist.c, here is the context for this error [printfile()]: The only way we can see this happening is if size <0; in other words, something has written more into the file since we opened it. Is that a correct interpretation? If so, the error message doesn't really jive with the error condition. Shouldn't the test be:static void printfile(struct protstream *out, const struct dlist *dl) { char buf[4096]; struct stat sbuf; FILE *f; unsigned long size; f = fopen(dl->sval, "r"); if (!f) { syslog(LOG_ERR, "IOERROR: Failed to read file %s", dl->sval); prot_printf(out, "NIL"); return; } if (fstat(fileno(f), &sbuf) == -1) { syslog(LOG_ERR, "IOERROR: Failed to stat file %s", dl->sval); prot_printf(out, "NIL"); fclose(f); return; } size = sbuf.st_size; if (size != dl->nval) { syslog(LOG_ERR, "IOERROR: Size mismatch %s (%lu != " MODSEQ_FMT ")", dl->sval, size, dl->nval); prot_printf(out, "NIL"); fclose(f); return; } prot_printf(out, "%%{"); prot_printastring(out, dl->part); prot_printf(out, " "); prot_printastring(out, message_guid_encode(&dl->gval)); prot_printf(out, " %lu}\r\n", size); while (size) { int n = fread(buf, 1, (size > 4096 ? 4096 : size), f); if (n <= 0) break; prot_write(out, buf, n); size -= n; } fclose(f); if (size) fatal("failed to finish reading file!", EC_IOERR); } if (size > 0) fatal... instead? If size < 0, then manifestly we have finished reading the file. Cheers, -nic On 06/11/2013 01:34 PM, Nic Bernstein
wrote:
Friends, -- Nic Bernstein nic@xxxxxxxxxxx Onlight, Inc. www.onlight.com 219 N. Milwaukee St., Suite 2a v. 414.272.4477 Milwaukee, Wisconsin 53202 |
---- Cyrus Home Page: http://www.cyrusimap.org/ List Archives/Info: http://lists.andrew.cmu.edu/pipermail/info-cyrus/ To Unsubscribe: https://lists.andrew.cmu.edu/mailman/listinfo/info-cyrus