From f7b74c1725b497df5ce836545c127ad565175c70 Mon Sep 17 00:00:00 2001 From: rsc Date: Tue, 28 Dec 2004 17:34:05 +0000 Subject: FreeBSD tweaks --- src/cmd/9yacc.c | 7 +++++-- src/cmd/acid/main.c | 5 +++-- src/cmd/acidtypes/stabs.c | 5 +++-- src/cmd/auxstats/FreeBSD.c | 1 - src/cmd/draw/tweak.c | 6 +++--- src/cmd/gzip/unzip.c | 4 ++-- src/cmd/gzip/zip.c | 4 ++-- src/cmd/plumb/plumber.c | 3 ++- src/cmd/rc/unixcrap.c | 6 ++---- src/cmd/sam/sam.c | 4 ++-- src/cmd/sam/shell.c | 3 ++- 11 files changed, 26 insertions(+), 22 deletions(-) diff --git a/src/cmd/9yacc.c b/src/cmd/9yacc.c index 6614414d..3db6768f 100644 --- a/src/cmd/9yacc.c +++ b/src/cmd/9yacc.c @@ -614,10 +614,13 @@ summary(void) void error(char *s, ...) { + va_list arg; nerrors++; fprint(2, "\n fatal error:"); - fprint(2, s, (&s)[1]); + va_start(arg, s); + vfprint(2, s, arg); + va_end(arg); fprint(2, ", %s:%d\n", infile, lineno); if(!fatfl) return; @@ -2629,7 +2632,7 @@ callopt(void) case '$': break; default: - error("bad tempfile"); + error("bad tempfile %s", tempname); } break; } diff --git a/src/cmd/acid/main.c b/src/cmd/acid/main.c index 0d1909ce..f1372f84 100644 --- a/src/cmd/acid/main.c +++ b/src/cmd/acid/main.c @@ -52,7 +52,7 @@ dumbmap(int fd) void main(int argc, char *argv[]) { - Lsym *l; + Lsym *volatile l; Node *n; char buf[128], *s; int pid, i; @@ -173,7 +173,8 @@ main(int argc, char *argv[]) static int attachfiles(int argc, char **argv) { - int fd, pid; + int fd; + volatile int pid; char *s; int i, omode; Fhdr *hdr; diff --git a/src/cmd/acidtypes/stabs.c b/src/cmd/acidtypes/stabs.c index 90bd1de1..bd6e7188 100644 --- a/src/cmd/acidtypes/stabs.c +++ b/src/cmd/acidtypes/stabs.c @@ -600,8 +600,9 @@ out: int stabs2acid(Stab *stabs, Biobuf *b) { - int fno, i; - char c, *dir, *fn, *file, *name, *desc, *p; + volatile int fno, i; + char c, *file, *desc, *p; + char *volatile dir, *volatile fn, *volatile name; Ftypes *f; Type *t, *tt; StabSym sym; diff --git a/src/cmd/auxstats/FreeBSD.c b/src/cmd/auxstats/FreeBSD.c index b0379f88..d881ad86 100644 --- a/src/cmd/auxstats/FreeBSD.c +++ b/src/cmd/auxstats/FreeBSD.c @@ -88,7 +88,6 @@ xnet(int first) struct ifnet ifnet; struct ifnethead ifnethead; char name[16]; - int n; if(first) return; diff --git a/src/cmd/draw/tweak.c b/src/cmd/draw/tweak.c index 82a22ee1..6d8ee26c 100644 --- a/src/cmd/draw/tweak.c +++ b/src/cmd/draw/tweak.c @@ -179,9 +179,9 @@ usage(void) } void -main(int argc, char *argv[]) +main(volatile int argc, char **volatile argv) { - int i; + volatile int i; Event e; Thing *t; @@ -575,7 +575,7 @@ tget(char *file) Image *b; Subfont *s; Thing *t; - Dir *d; + Dir *volatile d; jmp_buf oerr; uchar buf[256]; char *data; diff --git a/src/cmd/gzip/unzip.c b/src/cmd/gzip/unzip.c index 2f7888de..70e10a1a 100644 --- a/src/cmd/gzip/unzip.c +++ b/src/cmd/gzip/unzip.c @@ -135,7 +135,7 @@ static int unztable(Biobuf *bin, char *file) { ZipHead zh; - int entries; + int volatile entries; entries = findCDir(bin, file); if(entries < 0) @@ -273,7 +273,7 @@ unzip(Biobuf *bin, char *file) { ZipHead zh; vlong off; - int ok, eok, entries; + int volatile ok, eok, entries; entries = findCDir(bin, file); if(entries < 0) diff --git a/src/cmd/gzip/zip.c b/src/cmd/gzip/zip.c index 0e0d6baa..63903ece 100644 --- a/src/cmd/gzip/zip.c +++ b/src/cmd/gzip/zip.c @@ -45,9 +45,9 @@ usage(void) } void -main(int argc, char *argv[]) +main(int volatile argc, char **volatile argv) { - char *zfile; + char *volatile zfile; int i, fd, err; zfile = nil; diff --git a/src/cmd/plumb/plumber.c b/src/cmd/plumb/plumber.c index 6d1d9d17..a05fe612 100644 --- a/src/cmd/plumb/plumber.c +++ b/src/cmd/plumb/plumber.c @@ -29,7 +29,8 @@ void threadmain(int argc, char *argv[]) { char buf[512]; - int fd, dofork; + int fd; + int volatile dofork; progname = "plumber"; dofork = 1; diff --git a/src/cmd/rc/unixcrap.c b/src/cmd/rc/unixcrap.c index 57da10ed..3a4dd2c3 100644 --- a/src/cmd/rc/unixcrap.c +++ b/src/cmd/rc/unixcrap.c @@ -1,5 +1,6 @@ #include #include +#include #include #include #include "rc.h" @@ -174,10 +175,7 @@ execumask(void) n = strtol(argv[0], &p, 8); if(*p != 0 || p == argv[0]) goto usage; - if(umask(n) < 0){ - fprint(mapfd(2), "umask: %r\n"); - goto out; - } + umask(n); goto out; } diff --git a/src/cmd/sam/sam.c b/src/cmd/sam/sam.c index 803b84e6..b5b16a10 100644 --- a/src/cmd/sam/sam.c +++ b/src/cmd/sam/sam.c @@ -38,9 +38,9 @@ void usage(void); extern int notify(void(*)(void*,char*)); int -main(int argc, char *argv[]) +main(int volatile argc, char **volatile argv) { - int i; + int volatile i; String *t; char **ap, **arg; diff --git a/src/cmd/sam/shell.c b/src/cmd/sam/shell.c index 2cac31bc..ee30e5d0 100644 --- a/src/cmd/sam/shell.c +++ b/src/cmd/sam/shell.c @@ -13,7 +13,8 @@ plan9(File *f, int type, String *s, int nest) { long l; int m; - int pid, fd; + int volatile pid; + int fd; int retcode; int pipe1[2], pipe2[2]; -- cgit v1.2.3