Always report the applet name when doing error reporting.
This commit is contained in:
@ -47,8 +47,7 @@ int chroot_main(int argc, char **argv)
|
||||
argv++;
|
||||
|
||||
if (chroot(*argv) || (chdir("/"))) {
|
||||
fatalError("chroot: cannot change root directory to %s: %s\n",
|
||||
*argv, strerror(errno));
|
||||
fatalError("cannot change root directory to %s: %s\n", *argv, strerror(errno));
|
||||
}
|
||||
|
||||
argc--;
|
||||
@ -62,8 +61,7 @@ int chroot_main(int argc, char **argv)
|
||||
prog = "/bin/sh";
|
||||
execlp(prog, prog, NULL);
|
||||
}
|
||||
fatalError("chroot: cannot execute %s: %s\n",
|
||||
prog, strerror(errno));
|
||||
fatalError("cannot execute %s: %s\n", prog, strerror(errno));
|
||||
|
||||
}
|
||||
|
||||
|
@ -66,7 +66,7 @@ struct tm *date_conv_time(struct tm *tm_time, const char *t_string)
|
||||
&(tm_time->tm_min), &(tm_time->tm_year));
|
||||
|
||||
if (nr < 4 || nr > 5) {
|
||||
fatalError(invalid_date, "date", t_string);
|
||||
fatalError(invalid_date, t_string);
|
||||
}
|
||||
|
||||
/* correct for century - minor Y2K problem here? */
|
||||
@ -150,7 +150,7 @@ struct tm *date_conv_ftime(struct tm *tm_time, const char *t_string)
|
||||
|
||||
}
|
||||
|
||||
fatalError(invalid_date, "date", t_string);
|
||||
fatalError(invalid_date, t_string);
|
||||
}
|
||||
|
||||
|
||||
@ -186,7 +186,7 @@ int date_main(int argc, char **argv)
|
||||
case 'u':
|
||||
utc = 1;
|
||||
if (putenv("TZ=UTC0") != 0)
|
||||
fatalError(memory_exhausted, "date");
|
||||
fatalError(memory_exhausted);
|
||||
break;
|
||||
case 'd':
|
||||
use_arg = 1;
|
||||
@ -236,12 +236,12 @@ int date_main(int argc, char **argv)
|
||||
/* Correct any day of week and day of year etc fields */
|
||||
tm = mktime(&tm_time);
|
||||
if (tm < 0)
|
||||
fatalError(invalid_date, "date", date_str);
|
||||
fatalError(invalid_date, date_str);
|
||||
|
||||
/* if setting time, set it */
|
||||
if (set_time) {
|
||||
if (stime(&tm) < 0) {
|
||||
fatalError("date: can't set date.\n");
|
||||
fatalError("can't set date.\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -708,13 +708,13 @@ static int md5_file(const char *filename,
|
||||
} else {
|
||||
fp = fopen(filename, OPENOPTS(binary));
|
||||
if (fp == NULL) {
|
||||
errorMsg("md5sum: %s: %s\n", filename, strerror(errno));
|
||||
errorMsg("%s: %s\n", filename, strerror(errno));
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if (md5_stream(fp, md5_result)) {
|
||||
errorMsg("md5sum: %s: %s\n", filename, strerror(errno));
|
||||
errorMsg("%s: %s\n", filename, strerror(errno));
|
||||
|
||||
if (fp != stdin)
|
||||
fclose(fp);
|
||||
@ -722,7 +722,7 @@ static int md5_file(const char *filename,
|
||||
}
|
||||
|
||||
if (fp != stdin && fclose(fp) == EOF) {
|
||||
errorMsg("md5sum: %s: %s\n", filename, strerror(errno));
|
||||
errorMsg("%s: %s\n", filename, strerror(errno));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -746,7 +746,7 @@ static int md5_check(const char *checkfile_name)
|
||||
} else {
|
||||
checkfile_stream = fopen(checkfile_name, "r");
|
||||
if (checkfile_stream == NULL) {
|
||||
errorMsg("md5sum: %s: %s\n", checkfile_name, strerror(errno));
|
||||
errorMsg("%s: %s\n", checkfile_name, strerror(errno));
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ extern int pwd_main(int argc, char **argv)
|
||||
char buf[BUFSIZ + 1];
|
||||
|
||||
if (getcwd(buf, sizeof(buf)) == NULL)
|
||||
fatalError("pwd: %s\n", strerror(errno));
|
||||
fatalError("%s\n", strerror(errno));
|
||||
|
||||
printf("%s\n", buf);
|
||||
return(TRUE);
|
||||
|
@ -70,12 +70,12 @@ extern int touch_main(int argc, char **argv)
|
||||
if (create == FALSE && errno == ENOENT)
|
||||
exit(TRUE);
|
||||
else {
|
||||
fatalError("touch: %s", strerror(errno));
|
||||
fatalError("%s", strerror(errno));
|
||||
}
|
||||
}
|
||||
close(fd);
|
||||
if (utime(*argv, NULL)) {
|
||||
fatalError("touch: %s", strerror(errno));
|
||||
fatalError("%s", strerror(errno));
|
||||
}
|
||||
argc--;
|
||||
argv++;
|
||||
|
@ -189,7 +189,7 @@ extern int tr_main(int argc, char **argv)
|
||||
complement(input);
|
||||
if (argv[index] != NULL) {
|
||||
if (*argv[index] == '\0')
|
||||
fatalError("tr: STRING2 cannot be empty\n");
|
||||
fatalError("STRING2 cannot be empty\n");
|
||||
expand(argv[index], output);
|
||||
map(input, output);
|
||||
}
|
||||
|
@ -286,7 +286,7 @@ static int decode (const char *inname,
|
||||
&& (freopen (outname, "w", stdout) == NULL
|
||||
|| chmod (outname, mode & (S_IRWXU | S_IRWXG | S_IRWXO))
|
||||
)) {
|
||||
errorMsg("uudeoce %s: %s %s\n", outname, inname, strerror(errno)); /* */
|
||||
errorMsg("%s: %s %s\n", outname, inname, strerror(errno)); /* */
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -340,7 +340,7 @@ int uudecode_main (int argc,
|
||||
if (decode (argv[optind], outname) != 0)
|
||||
exit_status = FALSE;
|
||||
} else {
|
||||
errorMsg("uudecode: %s: %s\n", argv[optind], strerror(errno));
|
||||
errorMsg("%s: %s\n", argv[optind], strerror(errno));
|
||||
exit_status = FALSE;
|
||||
}
|
||||
optind++;
|
||||
|
@ -217,7 +217,7 @@ int uuencode_main (int argc,
|
||||
case 2:
|
||||
/* Optional first argument is input file. */
|
||||
if (!freopen (argv[optind], "r", stdin) || fstat (fileno (stdin), &sb)) {
|
||||
errorMsg("uuencode: %s: %s\n", argv[optind], strerror(errno));
|
||||
errorMsg("%s: %s\n", argv[optind], strerror(errno));
|
||||
exit FALSE;
|
||||
}
|
||||
mode = sb.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO);
|
||||
|
Reference in New Issue
Block a user