rsyncing fifos and sockets on FreeBSD

Dominik Brettnacher domi at saargate.de
Mon Oct 27 01:11:55 EST 2003


Hi there,

I already asked the list about the problems with sockets on FreeBSD (see
here: http://www.mail-archive.com/rsync@lists.samba.org/msg08121.html).

I adopted Andrew Flury's patch to the recent CVS version of rsync:


Index: rsync.h
===================================================================
RCS file: /cvsroot/rsync/rsync.h,v
retrieving revision 1.155
diff -r1.155 rsync.h
134a135,138
> #ifdef HAVE_SYS_UN_H
> #include <sys/un.h>
> #endif
>
Index: syscall.c
===================================================================
RCS file: /cvsroot/rsync/syscall.c,v
retrieving revision 1.27
diff -r1.27 syscall.c
70a71,98
>
> #if HAVE_MKFIFO
> 	if (S_ISFIFO(mode))
> 		return mkfifo(pathname, mode);
> #endif
> #if (HAVE_SYS_UN_H && HAVE_SYS_SOCKET_H)
> 	if (S_ISSOCK(mode)) {
> 		int sock;
> 		struct sockaddr_un saddr;
>
> 		if (strlen(pathname) + 1 > sizeof(saddr.sun_path)) {
> 			errno = ENAMETOOLONG; return -1;
> 		}
>
> 		saddr.sun_family = AF_UNIX;
> 		strncpy(saddr.sun_path, pathname, sizeof(saddr.sun_path));
>
> 		if ((sock = socket(PF_UNIX, SOCK_STREAM, 0)) == -1) {
> 			return -1;
> 		}
> 		unlink(pathname);
> 		if ((bind(sock, (struct sockaddr*)&saddr, sizeof(saddr))) == -1) {
> 			return -1;
> 		}
> 		close(sock);
> 		return do_chmod(pathname, mode);
> 	}
> #endif

-- 
Regards,

Dominik

"Je planmäßiger die Menschen vorgehen,
 desto wirksamer mag der Zufall sie zu treffen."
			-- Friedrich Dürrenmatt



More information about the rsync mailing list