1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-12 09:58:36 +00:00

Don't call err() with no format string.

This commit is contained in:
Kris Kennaway 2000-07-10 09:14:15 +00:00
parent 3d3f014fd4
commit 0c4d24a78f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=62894
4 changed files with 21 additions and 21 deletions

View File

@ -189,7 +189,7 @@ main(argc, argv)
in_name = argv[i]; /* remember name of input file */
input = fopen(in_name, "r");
if (input == 0) /* check for open error */
err(1, in_name);
err(1, "%s", in_name);
continue;
}
else if (output == 0) { /* we have the output file */
@ -200,7 +200,7 @@ main(argc, argv)
}
output = fopen(out_name, "w");
if (output == 0) /* check for create error */
err(1, out_name);
err(1, "%s", out_name);
continue;
}
errx(1, "unknown parameter: %s", argv[i]);
@ -1160,23 +1160,23 @@ bakcopy()
/* copy in_name to backup file */
bakchn = creat(bakfile, 0600);
if (bakchn < 0)
err(1, bakfile);
err(1, "%s", bakfile);
while (n = read(fileno(input), buff, sizeof buff))
if (write(bakchn, buff, n) != n)
err(1, bakfile);
err(1, "%s", bakfile);
if (n < 0)
err(1, in_name);
err(1, "%s", in_name);
close(bakchn);
fclose(input);
/* re-open backup file as the input file */
input = fopen(bakfile, "r");
if (input == 0)
err(1, bakfile);
err(1, "%s", bakfile);
/* now the original input file will be the output */
output = fopen(in_name, "w");
if (output == 0) {
unlink(bakfile);
err(1, in_name);
err(1, "%s", in_name);
}
}

View File

@ -136,14 +136,14 @@ main(argc, argv)
ops |= pid ? KTROP_CLEAR : KTROP_CLEARFILE;
if (ktrace(tracefile, ops, trpoints, pid) < 0)
err(1, tracefile);
err(1, "%s", tracefile);
exit(0);
}
omask = umask(S_IRWXG|S_IRWXO);
if (append) {
if ((fd = open(tracefile, O_CREAT | O_WRONLY, DEFFILEMODE)) < 0)
err(1, tracefile);
err(1, "%s", tracefile);
if (fstat(fd, &sb) != 0 || sb.st_uid != getuid())
errx(1, "Refuse to append to %s not owned by you.",
tracefile);
@ -152,19 +152,19 @@ main(argc, argv)
err(1, "unlink %s", tracefile);
if ((fd = open(tracefile, O_CREAT | O_EXCL | O_WRONLY,
DEFFILEMODE)) < 0)
err(1, tracefile);
err(1, "%s", tracefile);
}
(void)umask(omask);
(void)close(fd);
if (*argv) {
if (ktrace(tracefile, ops, trpoints, getpid()) < 0)
err(1, tracefile);
err(1, "%s", tracefile);
execvp(argv[0], &argv[0]);
err(1, "exec of '%s' failed", argv[0]);
}
else if (ktrace(tracefile, ops, trpoints, pid) < 0)
err(1, tracefile);
err(1, "%s", tracefile);
exit(0);
}

View File

@ -85,13 +85,13 @@ main(int argc, char **argv)
fdi = open(kernname ,O_RDONLY);
if(fdi<0) {
warn(kernname);
warn("%s", kernname);
return 2;
}
/* figure out how big the uncompressed image will be */
if (read (fdi, (char *)&hdr, sizeof(hdr)) != sizeof(hdr))
err(2, argv[1]);
err(2, "%s", argv[1]);
size = hdr.a_text + hdr.a_data + hdr.a_bss;
entry = hdr.a_entry & 0x00FFFFFF;
@ -106,7 +106,7 @@ main(int argc, char **argv)
fdo = open(obj,O_WRONLY|O_TRUNC|O_CREAT,0666);
if(fdo<0) {
warn(obj);
warn("%s", obj);
return 2;
}
@ -222,13 +222,13 @@ main(int argc, char **argv)
fdn = open(obj ,O_RDONLY);
if(fdn<0) {
warn(obj);
warn("%s", obj);
return 3;
}
/* figure out how big the compressed image is */
if (read (fdn, (char *)&hdr, sizeof(hdr)) != sizeof(hdr)) {
warn(obj);
warn("%s", obj);
return 3;
}
close(fdn);
@ -251,11 +251,11 @@ extract (char *file)
struct exec hdr;
if (read (0, (char *)&hdr, sizeof(hdr)) != sizeof(hdr))
err(2, file);
err(2, "%s", file);
if (hdr.a_magic != ZMAGIC)
errx(2, "bad magic in file %s, probably not a kernel", file);
if (lseek (0, N_TXTOFF(hdr), 0) < 0)
err(2, file);
err(2, "%s", file);
sz = N_SYMOFF (hdr) - N_TXTOFF (hdr);
@ -269,7 +269,7 @@ extract (char *file)
n = read (0, buf, l);
if (n != l) {
if (n == -1)
err(1, file);
err(1, "%s", file);
else
errx(1, "unexpected EOF");
}

View File

@ -118,7 +118,7 @@ getargs(av)
if (*p == '-')
ip->fp = stdin;
else if ((ip->fp = fopen(p, "r")) == NULL) {
err(1, p);
err(1, "%s", p);
}
ip->pad = P;
if (!ip->sepstring)