aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-07-16 19:29:27 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-07-16 22:47:59 +0200
commitbfd876dbf151df164b4d87de20aec39b24f205f9 (patch)
tree53ac348da6c430b1ecf5f546ee4758ac73cb16e0 /include
parent74a064d9f15fa2d534e8b2d1ade68d10d5b65dfd (diff)
cleanup: move error handling into write_retry
If write_retry fails to write everything, it is *always* an error. This commit renames write_retry to write_data and moves error handling into the function, making a lot of error handling code redundant. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'include')
-rw-r--r--include/util.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/include/util.h b/include/util.h
index 997cbf5..aff313f 100644
--- a/include/util.h
+++ b/include/util.h
@@ -23,9 +23,11 @@ int canonicalize_name(char *filename);
/*
A wrapper around the write() system call. It retries the write if it is
- interrupted by a signal or only part of the data was written.
+ interrupted by a signal or only part of the data was written. Returns 0
+ on success. Writes to stderr on failure using 'errstr' as a perror style
+ error prefix.
*/
-ssize_t write_retry(int fd, const void *data, size_t size);
+int write_data(const char *errstr, int fd, const void *data, size_t size);
/*
A wrapper around the read() system call. It retries the read if it is