From: lum Date: Wed, 24 Feb 2021 13:58:46 +0000 (+0000) Subject: snprintf() does indeed return an int. From an email Joachim Nilsson X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=a972a8b72bdb56bfb9dca1d7c3c9291d5832e081;p=openbsd snprintf() does indeed return an int. From an email Joachim Nilsson sent to tech@ many moons ago. Sorry for the delay. --- diff --git a/usr.bin/mg/dired.c b/usr.bin/mg/dired.c index 69c806f4ebc..90d9a638373 100644 --- a/usr.bin/mg/dired.c +++ b/usr.bin/mg/dired.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dired.c,v 1.93 2019/07/11 18:20:18 lum Exp $ */ +/* $OpenBSD: dired.c,v 1.94 2021/02/24 13:58:46 lum Exp $ */ /* This file is in the public domain. */ @@ -479,9 +479,9 @@ d_copy(int f, int n) topath = adjustname(toname, TRUE); if (stat(topath, &statbuf) == 0) { if (S_ISDIR(statbuf.st_mode)) { - off = snprintf(toname, sizeof(toname), "%s/%s", + ret = snprintf(toname, sizeof(toname), "%s/%s", topath, sname); - if (off < 0 || off >= sizeof(toname) - 1) { + if (ret < 0 || ret >= sizeof(toname) - 1) { dobeep(); ewprintf("Directory name too long"); return (FALSE);