diff options
author | Kris Kennaway <kris@FreeBSD.org> | 2002-10-26 01:16:02 +0000 |
---|---|---|
committer | Kris Kennaway <kris@FreeBSD.org> | 2002-10-26 01:16:02 +0000 |
commit | 24a46374181088f0b9a6413cada18e3999dcf7a7 (patch) | |
tree | 567bf617a7a32d0a78c5df125622beadede6a0b2 /net/sup | |
parent | Fix build on -current (cope with removal of union wait, and add (diff) |
Fix build on -current (cope with removal of union wait)
Submitted by: mike
Notes
Notes:
svn path=/head/; revision=68842
Diffstat (limited to 'net/sup')
-rw-r--r-- | net/sup/files/patch-aa | 40 | ||||
-rw-r--r-- | net/sup/files/patch-ac | 96 | ||||
-rw-r--r-- | net/sup/files/patch-run.c | 56 | ||||
-rw-r--r-- | net/sup/files/patch-supcmeat.c | 35 | ||||
-rw-r--r-- | net/sup/files/patch-supfilesrv.c | 107 |
5 files changed, 198 insertions, 136 deletions
diff --git a/net/sup/files/patch-aa b/net/sup/files/patch-aa index 70e49e6f50ff..6702b5f6f45a 100644 --- a/net/sup/files/patch-aa +++ b/net/sup/files/patch-aa @@ -190,46 +190,6 @@ diff -c /var/tmp/sup/log.c sup/log.c opened++; } -diff -c /var/tmp/sup/run.c sup/run.c -*** run.c Fri Aug 20 17:46:33 1993 ---- sup/run.c Thu Apr 6 13:32:15 1995 -*************** -*** 95,100 **** ---- 95,101 ---- - #include <signal.h> - #include <sys/wait.h> - #include <varargs.h> -+ #define MAXARGS 100 - - static int dorun(); - -*************** -*** 123,132 **** - { - int val; - va_list ap; -! - va_start(ap); -! val = runvp (name,ap); - va_end(ap); - return (val); - } - ---- 124,137 ---- - { - int val; - va_list ap; -! char *args[MAXARGS]; -! int argno=0; -! - va_start(ap); -! while (argno < MAXARGS -! && (args[argno++] = va_arg(ap, char *)) != (char *)0); - va_end(ap); -+ val = runvp (name,args); - return (val); - } - diff -c /var/tmp/sup/scan.c sup/scan.c *** scan.c Fri Aug 20 17:46:33 1993 --- sup/scan.c Sun Aug 13 18:44:51 1995 diff --git a/net/sup/files/patch-ac b/net/sup/files/patch-ac index 1da07266614d..72885cc2183d 100644 --- a/net/sup/files/patch-ac +++ b/net/sup/files/patch-ac @@ -138,99 +138,3 @@ diff -u -r1.1.1.1 -r1.3 fprintf (noteF,"SUP Upgrade of %s at %s", collrelname,ctime (&tloc)); (void) fflush (noteF); -Index: supfilesrv.c -=================================================================== -RCS file: /home/ncvs/src/usr.sbin/sup/supfilesrv/supfilesrv.c,v -retrieving revision 1.4 -retrieving revision 1.6 -diff -u -r1.4 -r1.6 ---- supfilesrv.c 1996/02/06 19:03:58 1.4 -+++ supfilesrv.c 1996/09/24 08:43:04 1.6 -@@ -254,7 +254,6 @@ - #include <sys/wait.h> - #include <sys/stat.h> - #include <sys/file.h> --#include <sys/dir.h> - #if MACH - #include <sys/ioctl.h> - #endif -@@ -277,7 +276,6 @@ - #endif /* lint */ - - extern int errno; --long time (); - uid_t getuid (); - - int maxchildren; -@@ -1218,6 +1216,7 @@ - register int fdtmp; - char sys_com[STRINGLENGTH], temp_file[STRINGLENGTH], rcs_file[STRINGLENGTH]; - union wait status; -+ int wstat; - char *uconvert(),*gconvert(); - int sendfile (); - -@@ -1285,15 +1284,54 @@ - #endif - if (fd == -1) { - if (docompress) { -- tmpnam(temp_file); -- sprintf(sys_com, "gzip -c < %s > %s\n", t->Tname, temp_file); -- if (system(sys_com) != 0) { -- /* Just in case */ -- unlink(temp_file); -- goaway ("We died trying to \"%s\"", sys_com); -- t->Tmode = 0; -- } -- fd = open (temp_file,O_RDONLY,0); -+ FILE *tf; -+ int pid; -+ int i; -+ -+ tf = tmpfile(); -+ if (tf == NULL) { -+ goaway("no temp file"); -+ t->Tmode = 0; -+ goto out; -+ } -+ pid = fork(); -+ switch (pid) { -+ case -1: /* fail */ -+ goaway("Could not fork"); -+ t->Tmode = 0; -+ fclose(tf); -+ break; -+ case 0: /* child */ -+ close(1); -+ dup(fileno(tf));/* write end */ -+ for(i = 3; i < 64; i++) -+ close(i); -+ execl("/usr/bin/gzip", "sup-gzip", "-c", t->Tname, 0); -+ execl("/usr/local/bin/gzip", "sup-gzip", "-c", t->Tname, 0); -+ execlp("gzip", "sup-gzip", "-c", t->Tname, 0); -+ perror("gzip"); -+ _exit(1); /* pipe breaks */ -+ default: /* parent */ -+ wait(&wstat); -+ if (WIFEXITED(wstat) && -+ WEXITSTATUS(wstat) > 0) { -+ fclose(tf); -+ goaway("gzip failed!"); -+ t->Tmode = 0; -+ goto out; -+ } -+ if (WIFSIGNALED(wstat)) { -+ fclose(tf); -+ goaway("gzip died!"); -+ t->Tmode = 0; -+ goto out; -+ } -+ fd = dup(fileno(tf)); -+ fclose(tf); -+ lseek(fd, 0, 0); -+ break; -+ } -+ out: - } - else - fd = open (t->Tname,O_RDONLY,0); diff --git a/net/sup/files/patch-run.c b/net/sup/files/patch-run.c new file mode 100644 index 000000000000..d57f77daf692 --- /dev/null +++ b/net/sup/files/patch-run.c @@ -0,0 +1,56 @@ +--- run.c.orig Fri Aug 20 20:46:33 1993 ++++ run.c Fri Oct 25 10:23:26 2002 +@@ -95,6 +95,7 @@ + #include <signal.h> + #include <sys/wait.h> + #include <varargs.h> ++#define MAXARGS 100 + + static int dorun(); + +@@ -123,10 +124,14 @@ + { + int val; + va_list ap; +- ++ char *args[MAXARGS]; ++ int argno=0; ++ + va_start(ap); +- val = runvp (name,ap); ++ while (argno < MAXARGS ++ && (args[argno++] = va_arg(ap, char *)) != (char *)0); + va_end(ap); ++ val = runvp (name,args); + return (val); + } + +@@ -144,7 +149,7 @@ + int wpid; + register int pid; + struct sigvec ignoresig,intsig,quitsig; +- union wait status; ++ int status; + int execvp(), execv(); + int (*execrtn)() = usepath ? execvp : execv; + +@@ -165,7 +170,7 @@ + sigvec (SIGINT,&ignoresig,&intsig); + sigvec (SIGQUIT,&ignoresig,&quitsig); + do { +- wpid = wait3 (&status.w_status, WUNTRACED, 0); ++ wpid = wait3 (&status, WUNTRACED, 0); + if (WIFSTOPPED (status)) { + kill (0,SIGTSTP); + wpid = 0; +@@ -174,8 +179,8 @@ + sigvec (SIGINT,&intsig,0); /* restore signals */ + sigvec (SIGQUIT,&quitsig,0); + +- if (WIFSIGNALED (status) || status.w_retcode == 0377) ++ if (WIFSIGNALED (status) || WEXITSTATUS(status) == 0377) + return (-1); + +- return (status.w_retcode); ++ return (WEXITSTATUS(status)); + } diff --git a/net/sup/files/patch-supcmeat.c b/net/sup/files/patch-supcmeat.c new file mode 100644 index 000000000000..63e297ec9b45 --- /dev/null +++ b/net/sup/files/patch-supcmeat.c @@ -0,0 +1,35 @@ +--- supcmeat.c.orig Fri Oct 25 10:27:43 2002 ++++ supcmeat.c Fri Oct 25 10:27:43 2002 +@@ -1107,7 +1107,7 @@ + { + struct stat sbuf; + struct timeval tbuf[2]; +- union wait w; ++ int w; + + if (thisC->Cflags&CFLIST) { + vnotify ("SUP Would execute %s\n",t->Tname); +@@ -1123,18 +1123,18 @@ + notify ("SUP Unable to stat file %s\n", *name); + sbuf.st_ino = 0; + } +- w.w_status = system (t->Tname); +- if (WIFEXITED(w) && w.w_retcode != 0) { ++ w = system (t->Tname); ++ if (WIFEXITED(w) && WEXITSTATUS(w) != 0) { + notify ("SUP: Execute command returned failure status %#o\n", +- w.w_retcode); ++ WEXITSTATUS(w)); + thisC->Cnogood = TRUE; + } else if (WIFSIGNALED(w)) { + notify ("SUP: Execute command killed by signal %d\n", +- w.w_termsig); ++ WTERMSIG(w)); + thisC->Cnogood = TRUE; + } else if (WIFSTOPPED(w)) { + notify ("SUP: Execute command stopped by signal %d\n", +- w.w_stopsig); ++ WSTOPSIG(w)); + thisC->Cnogood = TRUE; + } + if ((sbuf.st_ino != 0) && (sbuf.st_mode&S_IFMT) != S_IFLNK){ diff --git a/net/sup/files/patch-supfilesrv.c b/net/sup/files/patch-supfilesrv.c new file mode 100644 index 000000000000..0c1a646f5323 --- /dev/null +++ b/net/sup/files/patch-supfilesrv.c @@ -0,0 +1,107 @@ +--- supfilesrv.c.orig Fri Oct 25 10:27:43 2002 ++++ supfilesrv.c Fri Oct 25 10:30:55 2002 +@@ -254,7 +254,6 @@ + #include <sys/wait.h> + #include <sys/stat.h> + #include <sys/file.h> +-#include <sys/dir.h> + #if MACH + #include <sys/ioctl.h> + #endif +@@ -277,7 +276,6 @@ + #endif /* lint */ + + extern int errno; +-long time (); + uid_t getuid (); + + int maxchildren; +@@ -1217,7 +1215,8 @@ + register int x,fd; + register int fdtmp; + char sys_com[STRINGLENGTH], temp_file[STRINGLENGTH], rcs_file[STRINGLENGTH]; +- union wait status; ++ int status; ++ int wstat; + char *uconvert(),*gconvert(); + int sendfile (); + +@@ -1252,11 +1251,11 @@ + sprintf(sys_com, "co -q -p %s %s > %s 2> /dev/null\n", rcs_release, t->Tname, rcs_file); + #endif + /*loginfo("using rcs mode \"%s\"\n", sys_com);*/ +- status.w_status = system(sys_com); +- if (status.w_status < 0 || status.w_retcode) { ++ status = system(sys_com); ++ if (WTERMSIG(status) < 0 || WEXITSTATUS(status)) { + /* Just in case */ + unlink(rcs_file); +- if (status.w_status < 0) { ++ if (WTERMSIG(status) < 0) { + goaway ("We died trying to \"%s\"", sys_com); + t->Tmode = 0; + } +@@ -1285,15 +1284,54 @@ + #endif + if (fd == -1) { + if (docompress) { +- tmpnam(temp_file); +- sprintf(sys_com, "gzip -c < %s > %s\n", t->Tname, temp_file); +- if (system(sys_com) != 0) { +- /* Just in case */ +- unlink(temp_file); +- goaway ("We died trying to \"%s\"", sys_com); +- t->Tmode = 0; +- } +- fd = open (temp_file,O_RDONLY,0); ++ FILE *tf; ++ int pid; ++ int i; ++ ++ tf = tmpfile(); ++ if (tf == NULL) { ++ goaway("no temp file"); ++ t->Tmode = 0; ++ goto out; ++ } ++ pid = fork(); ++ switch (pid) { ++ case -1: /* fail */ ++ goaway("Could not fork"); ++ t->Tmode = 0; ++ fclose(tf); ++ break; ++ case 0: /* child */ ++ close(1); ++ dup(fileno(tf));/* write end */ ++ for(i = 3; i < 64; i++) ++ close(i); ++ execl("/usr/bin/gzip", "sup-gzip", "-c", t->Tname, 0); ++ execl("/usr/local/bin/gzip", "sup-gzip", "-c", t->Tname, 0); ++ execlp("gzip", "sup-gzip", "-c", t->Tname, 0); ++ perror("gzip"); ++ _exit(1); /* pipe breaks */ ++ default: /* parent */ ++ wait(&wstat); ++ if (WIFEXITED(wstat) && ++ WEXITSTATUS(wstat) > 0) { ++ fclose(tf); ++ goaway("gzip failed!"); ++ t->Tmode = 0; ++ goto out; ++ } ++ if (WIFSIGNALED(wstat)) { ++ fclose(tf); ++ goaway("gzip died!"); ++ t->Tmode = 0; ++ goto out; ++ } ++ fd = dup(fileno(tf)); ++ fclose(tf); ++ lseek(fd, 0, 0); ++ break; ++ } ++ out: + } + else + fd = open (t->Tname,O_RDONLY,0); |