summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>1998-05-16 00:46:16 +0000
committerAndrew Tridgell <tridge@samba.org>1998-05-16 00:46:16 +0000
commitf72399f8674aca5eae57b7981a233c7f4b95fb11 (patch)
treea128fff03174baf120cfe4418fd3db3e41d01576
parentd64488e169879350ab6c7ab07d24c076437afead (diff)
downloadrsync-f72399f8674aca5eae57b7981a233c7f4b95fb11.tar.gz
fixed handling of vsprintf on SunOS
-rw-r--r--util.c21
1 files changed, 7 insertions, 14 deletions
diff --git a/util.c b/util.c
index d9c87ece..04420048 100644
--- a/util.c
+++ b/util.c
@@ -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