diff options
author | Andrew Tridgell <tridge@samba.org> | 1998-05-16 00:46:16 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 1998-05-16 00:46:16 +0000 |
commit | f72399f8674aca5eae57b7981a233c7f4b95fb11 (patch) | |
tree | a128fff03174baf120cfe4418fd3db3e41d01576 | |
parent | d64488e169879350ab6c7ab07d24c076437afead (diff) | |
download | rsync-f72399f8674aca5eae57b7981a233c7f4b95fb11.tar.gz |
fixed handling of vsprintf on SunOS
-rw-r--r-- | util.c | 21 |
1 files changed, 7 insertions, 14 deletions
@@ -637,22 +637,15 @@ int vslprintf(char *str, int n, const char *format, va_list ap) } } - ret = vsprintf(buf, format, ap); - - if (ret < 0) { - str[0] = 0; - return -1; + vsprintf(buf, format, ap); + ret = strlen(buf); + if (ret > n) { + /* yikes! */ + exit(1); } - - if (ret < n) { - n = ret; - } else if (ret > n) { - ret = -1; - } - - buf[n] = 0; + buf[ret] = 0; - memcpy(str, buf, n+1); + memcpy(str, buf, ret+1); return ret; #endif |