diff options
author | Timo Teras <timo.teras@iki.fi> | 2009-08-12 11:05:09 +0300 |
---|---|---|
committer | Timo Teras <timo.teras@iki.fi> | 2009-08-12 11:05:09 +0300 |
commit | dee6ffa492c2efee982dcd0b4724213317eceb37 (patch) | |
tree | add143a84e1679384f0101e86cc712d387387a89 /src/apk_io.h | |
parent | bd9835a20ee6b191c844ebba0433e5d321c976f4 (diff) | |
download | apk-tools-dee6ffa492c2efee982dcd0b4724213317eceb37.tar.gz apk-tools-dee6ffa492c2efee982dcd0b4724213317eceb37.tar.bz2 apk-tools-dee6ffa492c2efee982dcd0b4724213317eceb37.tar.xz apk-tools-dee6ffa492c2efee982dcd0b4724213317eceb37.zip |
io: better error handling when writing stuff out
also have the output stream support writing to temporary file
and do renameat/unlinkat on close depending on if all writes
succeeded or not.
Diffstat (limited to 'src/apk_io.h')
-rw-r--r-- | src/apk_io.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/apk_io.h b/src/apk_io.h index 53b91b3..68f9925 100644 --- a/src/apk_io.h +++ b/src/apk_io.h @@ -46,7 +46,7 @@ struct apk_bstream { struct apk_ostream { ssize_t (*write)(void *stream, const void *buf, size_t size); - void (*close)(void *stream); + int (*close)(void *stream); }; #define APK_MPART_DATA 1 /* data processed so far */ @@ -81,8 +81,8 @@ struct apk_bstream *apk_bstream_from_url(const char *url); struct apk_bstream *apk_bstream_tee(struct apk_bstream *from, int atfd, const char *to); struct apk_ostream *apk_ostream_to_fd(int fd); -struct apk_ostream *apk_ostream_to_file(int atfd, const char *file, mode_t mode); -struct apk_ostream *apk_ostream_to_file_gz(int atfd, const char *file, mode_t mode); +struct apk_ostream *apk_ostream_to_file(int atfd, const char *file, const char *tmpfile, mode_t mode); +struct apk_ostream *apk_ostream_to_file_gz(int atfd, const char *file, const char *tmpfile, mode_t mode); size_t apk_ostream_write_string(struct apk_ostream *ostream, const char *string); apk_blob_t apk_blob_from_istream(struct apk_istream *istream, size_t size); |