1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-10-26 21:17:40 +00:00
freebsd-ports/net/sup/files/patch-ac

237 lines
6.8 KiB
Plaintext
Raw Normal View History

Index: expand.c
===================================================================
RCS file: /home/ncvs/src/usr.sbin/sup/lib/expand.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- expand.c 1995/12/26 04:54:46 1.1.1.1
+++ expand.c 1996/09/24 08:08:06 1.2
@@ -61,7 +61,7 @@
*/
#include <sys/param.h>
#include <sys/stat.h>
-#include <sys/dir.h>
+#include <dirent.h>
#include <pwd.h>
#include <ctype.h>
#include <libc.h>
@@ -159,7 +159,7 @@
static matchdir(pattern)
char *pattern;
{
- register struct direct *dp;
+ register struct dirent *dp;
DIR *dirp;
dirp = opendir(path);
Index: scan.c
===================================================================
RCS file: /home/ncvs/src/usr.sbin/sup/lib/scan.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- scan.c 1995/12/26 05:10:59 1.3
+++ scan.c 1996/09/24 08:08:11 1.4
1999-05-31 04:47:02 +00:00
@@ -93,8 +93,8 @@
#include <sys/types.h>
#include <sys/time.h>
#include <sys/stat.h>
-#include <sys/dir.h>
#include <sys/file.h>
+#include <dirent.h>
#include "sup.h"
/*************************
1999-05-31 04:47:02 +00:00
@@ -165,8 +165,6 @@
extern int trace; /* trace directories */
extern int newonly; /* new files only */
-extern long time();
-
/*************************************************
*** STATIC R O U T I N E S ***
*************************************************/
@@ -703,7 +701,7 @@
char *name;
int always;
{
- struct direct *dentry;
+ struct dirent *dentry;
register DIR *dirp;
char ename[STRINGLENGTH],newname[STRINGLENGTH],filename[STRINGLENGTH];
register char *p,*newp;
Index: scm.c
===================================================================
RCS file: /home/ncvs/src/usr.sbin/sup/lib/scm.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- scm.c 1995/12/26 05:02:49 1.2
+++ scm.c 1996/09/06 16:08:32 1.3
@@ -271,6 +280,8 @@
return (scmerr (errno, stderr, "Can't create socket for connections"));
if (setsockopt (sock,SOL_SOCKET,SO_REUSEADDR,(char *)&one,sizeof(int)) < 0)
(void) scmerr (errno, stderr, "Can't set SO_REUSEADDR socket option");
+ if (setsockopt (sock,SOL_SOCKET,SO_KEEPALIVE,(char *)&one,sizeof(int)) < 0)
+ (void) scmerr (errno, stderr, "Can't set SO_KEEPALIVE socket option");
(void) bzero ((char *)&sin,sizeof(sin));
sin.sin_family = AF_INET;
sin.sin_port = port;
Index: supcmeat.c
===================================================================
RCS file: /home/ncvs/src/usr.sbin/sup/sup/supcmeat.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- supcmeat.c 1995/12/26 05:03:05 1.2
+++ supcmeat.c 1996/10/30 23:58:07 1.3
@@ -325,7 +331,7 @@
/* If protocol is > 7 then try compression */
if (protver > 7) {
cancompress = TRUE;
- notify ("SUP Fileserver supports compression.\n");
+ vnotify ("SUP Fileserver supports compression.\n");
}
return (FALSE);
}
@@ -635,7 +641,7 @@
denyone (t)
register TREE *t;
{
- vnotify ("SUP: Access denied to %s\n",t->Tname);
+ notify ("SUP: Access denied to %s\n",t->Tname);
return (SCMOK);
}
Index: supcmisc.c
===================================================================
RCS file: /home/ncvs/src/usr.sbin/sup/sup/supcmisc.c,v
retrieving revision 1.1.1.1
retrieving revision 1.3
diff -u -r1.1.1.1 -r1.3
--- supcmisc.c 1995/12/26 04:54:46 1.1.1.1
+++ supcmisc.c 1996/10/31 00:03:14 1.3
@@ -277,7 +287,7 @@
#endif
char buf[STRINGLENGTH];
char collrelname[STRINGLENGTH];
- long tloc;
+ time_t tloc;
static FILE *noteF = NULL; /* mail program on pipe */
va_list ap;
@@ -300,7 +310,7 @@
if (noteF == NULL) {
if ((thisC->Cflags&CFMAIL) && thisC->Cnotify) {
- (void) sprintf (buf,"mail -s \"SUP Upgrade of %s\" %s >/dev/null",
+ (void) sprintf (buf,"/usr/bin/mail -s \"SUP Upgrade of %s\" %s >/dev/null",
collrelname,thisC->Cnotify);
noteF = popen (buf,"w");
if (noteF == NULL) {
@@ -310,7 +320,7 @@
}
} else
noteF = stdout;
- tloc = time ((long *)NULL);
+ tloc = time ((time_t *)NULL);
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
1999-05-31 04:47:02 +00:00
@@ -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
1999-05-31 04:47:02 +00:00
@@ -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 ();
1999-05-31 04:47:02 +00:00
@@ -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);