aboutsummaryrefslogtreecommitdiffstats
path: root/erts/lib_src/common
diff options
context:
space:
mode:
authorBjörn-Egil Dahlberg <[email protected]>2011-09-16 14:36:36 +0200
committerBjörn-Egil Dahlberg <[email protected]>2011-09-16 14:36:36 +0200
commitf5972a55dc7619b14887d46276918d82b9bcf44d (patch)
tree106dab3661655307252a97f04c1b107f92e8a896 /erts/lib_src/common
parent39968c33719b68001fb0e3f51f1d2aaa0cc4a612 (diff)
parent9c87b49e4433cf910a9f8d4548c5c3d2da3c5a5f (diff)
downloadotp-f5972a55dc7619b14887d46276918d82b9bcf44d.tar.gz
otp-f5972a55dc7619b14887d46276918d82b9bcf44d.tar.bz2
otp-f5972a55dc7619b14887d46276918d82b9bcf44d.zip
Merge branch 'dev' into major
* dev: Correct return values from write-functions in erl_printf
Diffstat (limited to 'erts/lib_src/common')
-rw-r--r--erts/lib_src/common/erl_printf.c12
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