* ifdata.docbook: Mark interface as required in synopsis. Closes: #588397
* Add missing AUTHOR section to docbook man pages.
+ * sponge: Correct bad use of fread that caused a trailing quantity of
+ soaked data to be silently discarded when a temp file was used
+ and sponge output to stdout. Closes: #595220
-- Joey Hess <joeyh@debian.org> Thu, 08 Jul 2010 14:40:07 -0400
}
static void copy_tmpfile(FILE *tmpfile, FILE *outfile, char *buf, size_t size) {
- if (fseek(tmpfile, 0, SEEK_SET)) {
+ ssize_t i;
+ if (lseek(fileno(tmpfile), 0, SEEK_SET)) {
perror("could to seek to start of temporary file");
fclose(tmpfile);
exit(1);
}
- while (fread(buf, size, 1, tmpfile) > 0) {
- write_buff_out(buf, size, outfile);
+ while ((i = read(fileno(tmpfile), buf, size)) > 0) {
+ write_buff_out(buf, i, outfile);
}
- if (ferror(tmpfile)) {
+ if (i == -1) {
perror("read temporary file");
fclose(tmpfile);
exit(1);