sbase

suckless unix tools
git clone git://git.2f30.org/sbase
Log | Files | Refs | README | LICENSE

commit b58951b4f07e45722ac32d831625cc21070de40e
parent 30620afb6c6c75e14ebd9de876114f88a83f0355
Author: sin <sin@2f30.org>
Date:   Fri, 24 Jan 2014 16:23:13 +0000

snprintf() returns the # of chars printed *excluding* '\0'

Diffstat:
Mutil/cp.c | 4++--
Mutil/enmasse.c | 2+-
2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/util/cp.c b/util/cp.c @@ -40,13 +40,13 @@ cp(const char *s1, const char *s2) if(strcmp(d->d_name, ".") && strcmp(d->d_name, "..")) { if(snprintf(ns1, size1, "%s/%s", s1, - d->d_name) > size1) { + d->d_name) >= size1) { eprintf("%s/%s: filename too long\n", s1, d->d_name); } if(snprintf(ns2, size2, "%s/%s", s2, - d->d_name) > size2) { + d->d_name) >= size2) { eprintf("%s/%s: filename too long\n", s2, d->d_name); } diff --git a/util/enmasse.c b/util/enmasse.c @@ -26,7 +26,7 @@ enmasse(int argc, char **argv, int (*fn)(const char *, const char *)) apathmax(&buf, &size); for(i = 0; i < argc; i++) { - if(snprintf(buf, size, "%s/%s", dir, basename(argv[i])) > size) { + if(snprintf(buf, size, "%s/%s", dir, basename(argv[i])) >= size) { eprintf("%s/%s: filename too long\n", dir, basename(argv[i])); }