From 0c4d24a78fbd9f937393e4fdf3bbb07c9b762c03 Mon Sep 17 00:00:00 2001 From: Kris Kennaway Date: Mon, 10 Jul 2000 09:14:15 +0000 Subject: [PATCH] Don't call err() with no format string. --- usr.bin/indent/indent.c | 14 +++++++------- usr.bin/ktrace/ktrace.c | 10 +++++----- usr.bin/kzip/kzip.c | 16 ++++++++-------- usr.bin/lam/lam.c | 2 +- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/usr.bin/indent/indent.c b/usr.bin/indent/indent.c index 02d34445ee75..08977bdd23cc 100644 --- a/usr.bin/indent/indent.c +++ b/usr.bin/indent/indent.c @@ -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); } } diff --git a/usr.bin/ktrace/ktrace.c b/usr.bin/ktrace/ktrace.c index 1c5a98ba6796..48d4871a210b 100644 --- a/usr.bin/ktrace/ktrace.c +++ b/usr.bin/ktrace/ktrace.c @@ -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); } diff --git a/usr.bin/kzip/kzip.c b/usr.bin/kzip/kzip.c index 97e1a4db356d..5af945a991ca 100644 --- a/usr.bin/kzip/kzip.c +++ b/usr.bin/kzip/kzip.c @@ -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"); } diff --git a/usr.bin/lam/lam.c b/usr.bin/lam/lam.c index 277081095af7..e65df368ce8d 100644 --- a/usr.bin/lam/lam.c +++ b/usr.bin/lam/lam.c @@ -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)