diff options
author | Björn-Egil Dahlberg <[email protected]> | 2011-09-16 14:35:50 +0200 |
---|---|---|
committer | Björn-Egil Dahlberg <[email protected]> | 2011-09-16 14:35:50 +0200 |
commit | 9c87b49e4433cf910a9f8d4548c5c3d2da3c5a5f (patch) | |
tree | abe9739bb2a9562df92e0872894c3bbb7b3b007e | |
parent | 062046d8a6bfee63e53f0342eaea58e9d50e1306 (diff) | |
parent | 24cb9395bd869ebd288995cadbcf25db3198f200 (diff) | |
download | otp-9c87b49e4433cf910a9f8d4548c5c3d2da3c5a5f.tar.gz otp-9c87b49e4433cf910a9f8d4548c5c3d2da3c5a5f.tar.bz2 otp-9c87b49e4433cf910a9f8d4548c5c3d2da3c5a5f.zip |
Merge branch 'pan/erts_printf_term/OTP-9435' into dev
* pan/erts_printf_term/OTP-9435:
Correct return values from write-functions in erl_printf
-rw-r--r-- | erts/lib_src/common/erl_printf.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/erts/lib_src/common/erl_printf.c b/erts/lib_src/common/erl_printf.c index 72d18ab6f1..6aa4569d44 100644 --- a/erts/lib_src/common/erl_printf.c +++ b/erts/lib_src/common/erl_printf.c @@ -108,7 +108,7 @@ write_f_add_cr(void *vfp, char* buf, size_t len) if (PUTC(buf[i], (FILE *) vfp) == EOF) return get_error_result(); } - return 0; + return len; } static int @@ -126,13 +126,14 @@ write_f(void *vfp, char* buf, size_t len) #endif if (FWRITE((void *) buf, sizeof(char), len, (FILE *) vfp) != len) return get_error_result(); - return 0; + return len; } static int write_fd(void *vfdp, char* buf, size_t len) { ssize_t size; + size_t res = len; ASSERT(vfdp); while (len) { @@ -149,7 +150,7 @@ write_fd(void *vfdp, char* buf, size_t len) len -= size; } - return 0; + return res; } static int @@ -160,7 +161,7 @@ write_s(void *vwbufpp, char* bufp, size_t len) ASSERT(len > 0); memcpy((void *) *wbufpp, (void *) bufp, len); *wbufpp += len; - return 0; + return len; } @@ -182,6 +183,7 @@ write_sn(void *vwsnap, char* buf, size_t len) memcpy((void *) wsnap->buf, (void *) buf, sz); wsnap->buf += sz; wsnap->len -= sz; + return sz; } return 0; } @@ -201,7 +203,7 @@ write_ds(void *vdsbufp, char* buf, size_t len) } memcpy((void *) (dsbufp->str + dsbufp->str_len), (void *) buf, len); dsbufp->str_len += len; - return 0; + return len; } int |