snprintf() returns the # of chars printed *excluding* '\0'
This commit is contained in:
parent
30620afb6c
commit
b58951b4f0
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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]));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user