Subject | Hash | Author | Date (UTC) |
---|---|---|---|
optimize tempfile copying | 6f31909ff74c064ea0b5126219b3e8f7b8826bee | Joey Hess | 2008-04-11 22:34:34 |
more fixes to tempfile writeback | a580bbd17850753746d6d1a2b65817edaf4485c9 | Joey Hess | 2008-04-11 22:27:40 |
set umask before calling mkstemp | 0595609018095dabd5d1a56cf03ddcc008a9e928 | Joey Hess | 2008-04-11 21:47:28 |
update physmem copyright | 30746c4357c0ac6110ca7e2a279ce9e82e879581 | Joey Hess | 2008-04-11 21:44:19 |
fix two bugs writing the output file | 6fa7d9907e7211f06656b296940aaca1d6b4d1df | Joey Hess | 2008-04-11 21:42:38 |
move code into a function | dcb580b3998a19b112004f23298490a34af59fc8 | Joey Hess | 2008-04-11 20:15:29 |
fix edge cases | ee4e74dd6a20706f29ef30a2613a1977f6f325fa | Joey Hess | 2008-04-11 20:10:18 |
reorder defines | 0bf88ea14cda6e6e57e97356862628ae49269c8a | Joey Hess | 2008-04-11 19:54:30 |
set up signal handlers before creating temp file | 0ff304e2ca860e51e75bbfc08290e364e94cb32e | Joey Hess | 2008-04-11 19:53:38 |
another round of whitespace fixes | c391b00d2837d1571ac1d361551378adf19ae83f | Joey Hess | 2008-04-11 19:50:47 |
remove debug | 919ce1f7b6d80dfdc3c613f898215962985f9c66 | Brock Noland | 2008-04-11 19:22:39 |
sponge fixes | 42c5c5a799502743307b392bf9e7c0205ef85ace | Brock Noland | 2008-04-11 18:16:09 |
better usage message | 73327f97a62619cb8b1a0bc03e5e105839449f9a | Joey Hess | 2008-04-11 04:36:46 |
update changelog | 79c6fe1242a4747c4adbcc9030d2cadc61c1028a | Joey Hess | 2008-04-11 04:35:24 |
convert to new format | 2c8be0fef4c247de0e5511abdbda25e3611b9f8c | Joey Hess | 2008-04-11 04:32:31 |
first pass thru the code | b2174f2df2410bf82fe646bcedd333ddbd7dbf66 | Joey Hess | 2008-04-11 03:49:31 |
make sponge use a temp file if the input is large | 866dfb32b3ba7d0be153608b28dd9f461986251d | Joey Hess | 2008-04-11 03:28:15 |
sponge, ifne: Ensure that suspending/resuming doesn't result in partial writes of the data, by using fwrite() rather than write(). | ddcbf562e3b6bb3a4441cc640c756127be4cf26b | Joey Hess | 2008-04-10 18:11:21 |
sponge: Ensure that suspending/resuming doesn't result in partial writes of the data, by using fwrite() rather than write(). | 71349b5ae83878f4e59fc6517976998150856933 | Joey Hess | 2008-04-10 18:05:25 |
Add ifne, contributed by Javier Merino. | 2fbf7a9636fae8012298901e98e63cc1b32745ee | Joey Hess | 2008-03-20 16:57:08 |
File | Lines added | Lines deleted |
---|---|---|
sponge.c | 5 | 7 |
File sponge.c changed (mode: 100644) (index a02e0e7..cf77e05) | |||
... | ... | static void write_buff_out(char* buff, size_t length, FILE *fd) { | |
199 | 199 | } | } |
200 | 200 | } | } |
201 | 201 | ||
202 | static void copy_tmpfile(FILE *tmpfile, FILE *outfile) { | ||
203 | char buf[BUFF_SIZE]; | ||
202 | static void copy_tmpfile(FILE *tmpfile, FILE *outfile, char *buf, size_t size) { | ||
204 | 203 | if (fseek(tmpfile, 0, SEEK_SET)) { | if (fseek(tmpfile, 0, SEEK_SET)) { |
205 | 204 | perror("could to seek to start of temporary file"); | perror("could to seek to start of temporary file"); |
206 | 205 | fclose(tmpfile); | fclose(tmpfile); |
207 | 206 | exit(1); | exit(1); |
208 | 207 | } | } |
209 | while (fread(buf, BUFF_SIZE, 1, tmpfile) > 0) { | ||
210 | write_buff_out(buf, BUFF_SIZE, outfile); | ||
208 | while (fread(buf, size, 1, tmpfile) > 0) { | ||
209 | write_buff_out(buf, size, outfile); | ||
211 | 210 | } | } |
212 | 211 | if (ferror(tmpfile)) { | if (ferror(tmpfile)) { |
213 | 212 | perror("read temporary file"); | perror("read temporary file"); |
... | ... | int main (int argc, char **argv) { | |
293 | 292 | /* write whatever we have in memory to tmpfile */ | /* write whatever we have in memory to tmpfile */ |
294 | 293 | if (bufused) | if (bufused) |
295 | 294 | write_buff_tmp(bufstart, bufused, tmpfile); | write_buff_tmp(bufstart, bufused, tmpfile); |
296 | free(bufstart); | ||
297 | 295 | if (fflush(tmpfile) != 0) { | if (fflush(tmpfile) != 0) { |
298 | 296 | perror("fflush"); | perror("fflush"); |
299 | 297 | exit(1); | exit(1); |
... | ... | int main (int argc, char **argv) { | |
322 | 320 | perror("error opening output file"); | perror("error opening output file"); |
323 | 321 | exit(1); | exit(1); |
324 | 322 | } | } |
325 | copy_tmpfile(tmpfile, outfile); | ||
323 | copy_tmpfile(tmpfile, outfile, bufstart, bufsize); | ||
326 | 324 | } | } |
327 | 325 | else { | else { |
328 | copy_tmpfile(tmpfile, stdout); | ||
326 | copy_tmpfile(tmpfile, stdout, bufstart, bufsize); | ||
329 | 327 | } | } |
330 | 328 | } | } |
331 | 329 | else { | else { |