summaryrefslogtreecommitdiff
path: root/src/apk_io.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/apk_io.h')
-rw-r--r--src/apk_io.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/apk_io.h b/src/apk_io.h
index d03369e..50464a9 100644
--- a/src/apk_io.h
+++ b/src/apk_io.h
@@ -92,9 +92,10 @@ static inline struct apk_istream *apk_istream_from_file(int atfd, const char *fi
static inline struct apk_istream *apk_istream_from_file_mmap(int atfd, const char *file) { return __apk_istream_from_file(atfd, file, 1); }
struct apk_istream *apk_istream_from_fd(int fd);
struct apk_istream *apk_istream_from_fd_url_if_modified(int atfd, const char *url, time_t since);
-static inline int apk_istream_error(struct apk_istream *is, int err) { if (!is->err) is->err = err; return err; }
+static inline int apk_istream_error(struct apk_istream *is, int err) { if (is->err >= 0 && err) is->err = err; return is->err < 0 ? is->err : 0; }
apk_blob_t apk_istream_mmap(struct apk_istream *is);
-ssize_t apk_istream_read(struct apk_istream *is, void *ptr, size_t size);
+ssize_t apk_istream_read_max(struct apk_istream *is, void *ptr, size_t size);
+int apk_istream_read(struct apk_istream *is, void *ptr, size_t size);
void *apk_istream_peek(struct apk_istream *is, size_t len);
void *apk_istream_get(struct apk_istream *is, size_t len);
int apk_istream_get_max(struct apk_istream *is, size_t size, apk_blob_t *data);