projects
/
libjh.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
io: write_nointr should treat count -1 as "just do strlen on the buffer"
[libjh.git]
/
io.c
diff --git
a/io.c
b/io.c
index
2173478
..
17ea4d6
100644
(file)
--- a/
io.c
+++ b/
io.c
@@
-1,5
+1,4
@@
// Copyright (2013) Jann Horn <jann@thejh.net>
// Copyright (2013) Jann Horn <jann@thejh.net>
-// This code is licensed under the AGPLv3.
HEADER #include <sys/types.h>
#include <unistd.h>
HEADER #include <sys/types.h>
#include <unistd.h>
@@
-43,7
+42,8
@@
PUBLIC_FN ssize_t read_nointr(int fd, void *buf, size_t count, int *last_res) {
// - -1: error
// - 0: stream ended
// - 1: no problems occured
// - -1: error
// - 0: stream ended
// - 1: no problems occured
-PUBLIC_FN ssize_t write_nointr(int fd, void *buf, size_t count, int *last_res) {
+PUBLIC_FN ssize_t write_nointr(int fd, void *buf, ssize_t count, int *last_res) {
+ if (count == -1) count = strlen(buf);
errno = 0;
size_t done = 0;
while (done < count) {
errno = 0;
size_t done = 0;
while (done < count) {