No need to use enprintf() with EXIT_FAILURE
eprintf() does just that.
This commit is contained in:
parent
b1b225c9ee
commit
94e97f19cd
2
du.c
2
du.c
|
@ -151,7 +151,7 @@ du(const char *path)
|
||||||
if (S_ISLNK(st.st_mode)) {
|
if (S_ISLNK(st.st_mode)) {
|
||||||
if (snprintf(file, sizeof(file), "%s/%s",
|
if (snprintf(file, sizeof(file), "%s/%s",
|
||||||
cwd, dent->d_name) >= sizeof(file))
|
cwd, dent->d_name) >= sizeof(file))
|
||||||
enprintf(EXIT_FAILURE, "path too long\n");
|
eprintf("path too long\n");
|
||||||
} else {
|
} else {
|
||||||
xrealpath(dent->d_name, file);
|
xrealpath(dent->d_name, file);
|
||||||
}
|
}
|
||||||
|
|
2
mktemp.c
2
mktemp.c
|
@ -43,7 +43,7 @@ main(int argc, char *argv[])
|
||||||
tmpdir = p;
|
tmpdir = p;
|
||||||
|
|
||||||
if (snprintf(tmppath, sizeof(tmppath), "%s/%s", tmpdir, template) >= sizeof(tmppath))
|
if (snprintf(tmppath, sizeof(tmppath), "%s/%s", tmpdir, template) >= sizeof(tmppath))
|
||||||
enprintf(EXIT_FAILURE, "path too long\n");
|
eprintf("path too long\n");
|
||||||
if (dflag) {
|
if (dflag) {
|
||||||
if (!mkdtemp(tmppath)) {
|
if (!mkdtemp(tmppath)) {
|
||||||
if (!qflag)
|
if (!qflag)
|
||||||
|
|
|
@ -34,7 +34,7 @@ recurse(const char *path, void (*fn)(const char *))
|
||||||
while (--p >= buf && *p == '/') *p ='\0';
|
while (--p >= buf && *p == '/') *p ='\0';
|
||||||
strlcat(buf, "/", sizeof(buf));
|
strlcat(buf, "/", sizeof(buf));
|
||||||
if (strlcat(buf, d->d_name, sizeof(buf)) >= sizeof(buf))
|
if (strlcat(buf, d->d_name, sizeof(buf)) >= sizeof(buf))
|
||||||
enprintf(EXIT_FAILURE, "path too long\n");
|
eprintf("path too long\n");
|
||||||
fn(buf);
|
fn(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
10
xargs.c
10
xargs.c
|
@ -78,7 +78,7 @@ main(int argc, char *argv[])
|
||||||
if (argsz + strlen(arg) + 1 > argmaxsz ||
|
if (argsz + strlen(arg) + 1 > argmaxsz ||
|
||||||
i >= NARGS - 1) {
|
i >= NARGS - 1) {
|
||||||
if (strlen(arg) + 1 > argmaxsz)
|
if (strlen(arg) + 1 > argmaxsz)
|
||||||
enprintf(EXIT_FAILURE, "insufficient argument space\n");
|
eprintf("insufficient argument space\n");
|
||||||
leftover = 1;
|
leftover = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -187,17 +187,15 @@ poparg(void)
|
||||||
goto out;
|
goto out;
|
||||||
case '\'':
|
case '\'':
|
||||||
if (parsequote('\'') == -1)
|
if (parsequote('\'') == -1)
|
||||||
enprintf(EXIT_FAILURE,
|
eprintf("unterminated single quote\n");
|
||||||
"unterminated single quote\n");
|
|
||||||
break;
|
break;
|
||||||
case '\"':
|
case '\"':
|
||||||
if (parsequote('\"') == -1)
|
if (parsequote('\"') == -1)
|
||||||
enprintf(EXIT_FAILURE,
|
eprintf("unterminated double quote\n");
|
||||||
"unterminated double quote\n");
|
|
||||||
break;
|
break;
|
||||||
case '\\':
|
case '\\':
|
||||||
if (parseescape() == -1)
|
if (parseescape() == -1)
|
||||||
enprintf(EXIT_FAILURE, "backslash at EOF\n");
|
eprintf("backslash at EOF\n");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
fillargbuf(ch);
|
fillargbuf(ch);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user