Subject | Hash | Author | Date (UTC) |
---|---|---|---|
minor changes | b6d635bc28bf7d94201bcd167905cebc48abf7cb | Joey Hess | 2008-04-11 23:03:50 |
honor TMPDIR | f69844b98d71598fbf9ef3f4da137b16eff1621e | Joey Hess | 2008-04-11 22:55:10 |
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 |
File | Lines added | Lines deleted |
---|---|---|
sponge.c | 7 | 5 |
File sponge.c changed (mode: 100644) (index f17bf86..0dd676a) | |||
... | ... | FILE *open_tmpfile(void) { | |
223 | 223 | mode_t mask; | mode_t mask; |
224 | 224 | char *tmpdir; | char *tmpdir; |
225 | 225 | char const * const template="%s/sponge.XXXXXX"; | char const * const template="%s/sponge.XXXXXX"; |
226 | |||
226 | |||
227 | trapsignals(); | ||
228 | cs = cs_enter(); | ||
227 | 229 | tmpdir = getenv("TMPDIR"); | tmpdir = getenv("TMPDIR"); |
228 | 230 | if (tmpdir == NULL) | if (tmpdir == NULL) |
229 | 231 | tmpdir = "/tmp"; | tmpdir = "/tmp"; |
... | ... | FILE *open_tmpfile(void) { | |
234 | 236 | exit(1); | exit(1); |
235 | 237 | } | } |
236 | 238 | sprintf(tmpname, template, tmpdir); | sprintf(tmpname, template, tmpdir); |
237 | |||
238 | trapsignals(); | ||
239 | cs = cs_enter(); | ||
240 | 239 | mask=umask(077); | mask=umask(077); |
241 | 240 | tmpfd = mkstemp(tmpname); | tmpfd = mkstemp(tmpname); |
242 | 241 | umask(mask); | umask(mask); |
243 | 242 | atexit(onexit_cleanup); // solaris on_exit(onexit_cleanup, 0); | atexit(onexit_cleanup); // solaris on_exit(onexit_cleanup, 0); |
244 | 243 | cs_leave(cs); | cs_leave(cs); |
244 | |||
245 | 245 | if (tmpfd < 0) { | if (tmpfd < 0) { |
246 | 246 | perror("mkstemp failed"); | perror("mkstemp failed"); |
247 | 247 | exit(1); | exit(1); |
... | ... | int main (int argc, char **argv) { | |
340 | 340 | } | } |
341 | 341 | } | } |
342 | 342 | else { | else { |
343 | outfile = stdout; | ||
344 | 343 | if (outname) { | if (outname) { |
345 | 344 | outfile = fopen(outname, "w"); | outfile = fopen(outname, "w"); |
346 | 345 | if (!outfile) { | if (!outfile) { |
... | ... | int main (int argc, char **argv) { | |
348 | 347 | exit(1); | exit(1); |
349 | 348 | } | } |
350 | 349 | } | } |
350 | else { | ||
351 | outfile = stdout; | ||
352 | } | ||
351 | 353 | if (bufused) | if (bufused) |
352 | 354 | write_buff_out(bufstart, bufused, outfile); | write_buff_out(bufstart, bufused, outfile); |
353 | 355 | fclose(outfile); | fclose(outfile); |