summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdio/snprintf.c
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>1997-11-29 19:28:29 +0000
committermillert <millert@openbsd.org>1997-11-29 19:28:29 +0000
commite7cbda6b2400f7b3fd6f2c6588628b12db5d638d (patch)
tree7ec21eeacf00a3131ad478bb0c4015a171aee43a /lib/libc/stdio/snprintf.c
parentFix to min/max-macro problem. (diff)
downloadwireguard-openbsd-e7cbda6b2400f7b3fd6f2c6588628b12db5d638d.tar.xz
wireguard-openbsd-e7cbda6b2400f7b3fd6f2c6588628b12db5d638d.zip
Return -1, not EOF for size < 1. XPG4.2 specifies the return value
should be < 1. While EOF is currently defined as -1 it is bad form to assume this.
Diffstat (limited to 'lib/libc/stdio/snprintf.c')
-rw-r--r--lib/libc/stdio/snprintf.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/libc/stdio/snprintf.c b/lib/libc/stdio/snprintf.c
index cab4690cd3b..2afabe725a0 100644
--- a/lib/libc/stdio/snprintf.c
+++ b/lib/libc/stdio/snprintf.c
@@ -35,7 +35,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: snprintf.c,v 1.3 1997/07/25 20:30:11 mickey Exp $";
+static char rcsid[] = "$OpenBSD: snprintf.c,v 1.4 1997/11/29 19:28:29 millert Exp $";
#endif /* LIBC_SCCS and not lint */
#include <stdio.h>
@@ -45,6 +45,7 @@ static char rcsid[] = "$OpenBSD: snprintf.c,v 1.3 1997/07/25 20:30:11 mickey Exp
#include <varargs.h>
#endif
+int
#ifdef __STDC__
snprintf(char *str, size_t n, char const *fmt, ...)
#else
@@ -60,7 +61,7 @@ snprintf(str, n, fmt, va_alist)
FILE f;
if ((int)n < 1)
- return (EOF);
+ return (-1);
#ifdef __STDC__
va_start(ap, fmt);
#else