enable copying of fifos/sockets

Requested by:	Eike Bernhardt <eike@unorganized.net>
PR:		59814
Obtained from:	Thomas Quinot <thomas@cuivre.fr.eu.org>
This commit is contained in:
Oliver Eikemeier 2004-08-24 16:30:50 +00:00
parent 9aba722079
commit 2e261a96c0
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=117204
4 changed files with 60 additions and 1 deletions

View file

@ -7,7 +7,7 @@
PORTNAME= rsync
PORTVERSION= 2.6.2
PORTREVISION= 2
PORTREVISION= 3
CATEGORIES= net ipv6
MASTER_SITES= http://rsync.samba.org/ftp/%SUBDIR%/ \
ftp://sunsite.auc.dk/pub/unix/%SUBDIR%/ \

View file

@ -1,2 +1,4 @@
MD5 (rsync-2.6.2.tar.gz) = bcacd9a9108a9e4760832212ec3d658d
SIZE (rsync-2.6.2.tar.gz) = 515402
MD5 (rsync-2.6.2-2.6.3pre1.diffs.gz) = 2ecd11b83c06a18c764ccee5dbdb25ab
SIZE (rsync-2.6.2-2.6.3pre1.diffs.gz) = 102947

View file

@ -0,0 +1,18 @@
#
# enable copying of fifos/sockets
# <http://lists.samba.org/archive/rsync/2002-June/002966.html>
# <http://www.freebsd.org/cgi/query-pr.cgi?pr=59814>
#
--- rsync.h.orig Tue Aug 24 16:37:59 2004
+++ rsync.h Tue Aug 24 16:38:28 2004
@@ -156,6 +156,10 @@
#include <sys/socket.h>
#endif
+#ifdef HAVE_SYS_UN_H
+#include <sys/un.h>
+#endif
+
#ifdef HAVE_STRING_H
#include <string.h>
#endif

View file

@ -0,0 +1,39 @@
#
# enable copying of fifos/sockets
# <http://lists.samba.org/archive/rsync/2002-June/002966.html>
# <http://www.freebsd.org/cgi/query-pr.cgi?pr=59814>
#
--- syscall.c.orig Wed Feb 18 23:33:21 2004
+++ syscall.c Tue Aug 24 17:56:25 2004
@@ -76,6 +76,31 @@
{
if (dry_run) return 0;
RETURN_ERROR_IF_RO_OR_LO;
+#if HAVE_MKFIFO
+ if (S_ISFIFO(mode))
+ return mkfifo(pathname, mode);
+#endif
+#if HAVE_SYS_UN_H
+ if (S_ISSOCK(mode)) {
+ int fd;
+ struct sockaddr_un *su;
+ size_t len;
+ if ((fd = socket(PF_UNIX, SOCK_STREAM, 0)) == -1)
+ return -1;
+ unlink(pathname);
+ len = sizeof(*su) - sizeof(su->sun_path) + strlen(pathname);
+ if ((su = calloc(1, len + 1)) == NULL)
+ return -1;
+ su->sun_len = len;
+ su->sun_family = AF_UNIX;
+ strcpy(su->sun_path, pathname);
+ if (bind(fd, (const struct sockaddr *)su, len) < 0)
+ return -1;
+ free(su);
+ close(fd);
+ return do_chmod(pathname, mode);
+ }
+#endif
return mknod(pathname, mode, dev);
}
#endif