Index: head/misc/dtach/Makefile =================================================================== --- head/misc/dtach/Makefile (revision 414999) +++ head/misc/dtach/Makefile (revision 415000) @@ -1,32 +1,31 @@ # Created by: Bjorn Lindstrom # $FreeBSD$ PORTNAME= dtach -PORTVERSION= 0.8 -PORTREVISION= 1 +PORTVERSION= 0.9 CATEGORIES= misc MASTER_SITES= SF MAINTAINER= ports@FreeBSD.org COMMENT= Emulates the detach feature of screen LICENSE= GPLv2+ LICENSE_FILE= ${WRKSRC}/COPYING GNU_CONFIGURE= yes ALL_TARGET= dtach PORTDOCS= README PLIST_FILES= bin/dtach man/man1/dtach.1.gz OPTIONS_DEFINE= DOCS do-install: ${INSTALL_PROGRAM} ${WRKSRC}/dtach ${STAGEDIR}${PREFIX}/bin ${INSTALL_MAN} ${WRKSRC}/dtach.1 ${STAGEDIR}${MANPREFIX}/man/man1 do-install-DOCS-on: @${MKDIR} ${STAGEDIR}${DOCSDIR} ${INSTALL_DATA} ${WRKSRC}/${PORTDOCS} ${STAGEDIR}${DOCSDIR} .include Index: head/misc/dtach/distinfo =================================================================== --- head/misc/dtach/distinfo (revision 414999) +++ head/misc/dtach/distinfo (revision 415000) @@ -1,2 +1,2 @@ -SHA256 (dtach-0.8.tar.gz) = 16614ebddf8ab2811d3dc0e7f329c7de88929ac6a9632d4cb4aef7fe11b8f2a9 -SIZE (dtach-0.8.tar.gz) = 55472 +SHA256 (dtach-0.9.tar.gz) = 32e9fd6923c553c443fab4ec9c1f95d83fa47b771e6e1dafb018c567291492f3 +SIZE (dtach-0.9.tar.gz) = 60608 Index: head/misc/dtach/files/patch-master.c =================================================================== --- head/misc/dtach/files/patch-master.c (revision 414999) +++ head/misc/dtach/files/patch-master.c (revision 415000) @@ -1,65 +1,41 @@ --- master.c.orig 2008-01-31 05:59:54 UTC +++ master.c @@ -53,6 +53,8 @@ struct client static struct client *clients; /* The pseudo-terminal created for the child process. */ static struct pty the_pty; +/* The mode of the socket */ +static mode_t socket_mode; #ifndef HAVE_FORKPTY pid_t forkpty(int *amaster, char *name, struct termios *termp, @@ -66,6 +68,19 @@ unlink_socket(void) unlink(sockname); } +/* Check the actual mode of the socket */ +static void +check_socket_mode(int has_attached_client) +{ + if (has_attached_client && ((socket_mode & 0100) != 0100)) { + socket_mode |= 0100; + chmod(sockname, socket_mode); + } else if (!has_attached_client && ((socket_mode & 0100) == 0100)) { + socket_mode &= ~0100; + chmod(sockname, socket_mode); + } +} + /* Signal */ static RETSIGTYPE die(int sig) @@ -206,7 +221,8 @@ create_socket(char *name) return -1; } /* chmod it to prevent any suprises */ - if (chmod(name, 0600) < 0) + socket_mode = 0600; + if (chmod(name, socket_mode) < 0) { close(s); return -1; -@@ -454,6 +470,8 @@ master_process(int s, char **argv, int w - /* Loop forever. */ - while (1) - { -+ int has_attached_client = 0; -+ - /* Re-initialize the file descriptor set for select. */ - FD_ZERO(&readfds); - FD_SET(s, &readfds); -@@ -480,8 +498,14 @@ master_process(int s, char **argv, int w - FD_SET(p->fd, &readfds); - if (p->fd > highest_fd) - highest_fd = p->fd; -+ -+ if (p->attached) { -+ has_attached_client = 1; -+ } - } - -+ check_socket_mode(has_attached_client); -+ - /* Wait for something to happen. */ - if (select(highest_fd + 1, &readfds, NULL, NULL, NULL) < 0) - {