From 8015edeebbd53f8fe3a444bdf469584a6c0bc80c Mon Sep 17 00:00:00 2001 From: David Malone Date: Sun, 28 Jul 2002 15:41:15 +0000 Subject: [PATCH] The return value of snprintf should be always nonnegative, so it should be safe to cast it to a size_t before comparing it to a sizeof(). --- usr.bin/csplit/csplit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.bin/csplit/csplit.c b/usr.bin/csplit/csplit.c index 35614be214ad..cdf5f0104034 100644 --- a/usr.bin/csplit/csplit.c +++ b/usr.bin/csplit/csplit.c @@ -234,7 +234,7 @@ newfile(void) { FILE *fp; - if (snprintf(currfile, sizeof(currfile), "%s%0*ld", prefix, + if ((size_t)snprintf(currfile, sizeof(currfile), "%s%0*ld", prefix, (int)sufflen, nfiles) >= sizeof(currfile)) { errno = ENAMETOOLONG; err(1, NULL);