Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Date: Wed, 19 Mar 2003 16:10:09 -0500 From: Jason Tishler Subject: chmod() on AF_UNIX sockets broken To: Cygwin Mail-followup-to: Cygwin Message-id: <20030319211009.GA1116@tishler.net> MIME-version: 1.0 Content-type: multipart/mixed; boundary="Boundary_(ID_DcAPNjcZ/GC9naH3EkNfFA)" User-Agent: Mutt/1.4i --Boundary_(ID_DcAPNjcZ/GC9naH3EkNfFA) Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7BIT Content-disposition: inline While tracking down a PostgreSQL problem, I uncovered that chmod() appears to have no affect on AF_UNIX sockets on recent Cygwin versions. The attached test case, afunix.cc, demonstrates the problem: $ # Cygwin 1.3.22-1 $ afunix $ ls -l /tmp/.afunix srwx------ 1 jt Domain U 0 Mar 19 15:57 /tmp/.afunix $ # Red Hat Linux 8.0 $ afunix $ ls -l /tmp/.afunix srwxrwxrwx 1 jt dev 0 Mar 19 17:13 /tmp/.afunix $ # Cygwin 1.3.18-1 $ afunix $ ls -l /tmp/.afunix srwxrwxrwx 1 jt Domain U 0 Mar 19 17:13 /tmp/.afunix Jason -- PGP/GPG Key: http://www.tishler.net/jason/pubkey.asc or key servers Fingerprint: 7A73 1405 7F2B E669 C19D 8784 1AFD E4CC ECF4 8EF6 --Boundary_(ID_DcAPNjcZ/GC9naH3EkNfFA) Content-type: text/plain; charset=us-ascii; NAME=afunix.cc Content-transfer-encoding: 7BIT Content-disposition: attachment; filename=afunix.cc #include #include #include #include #include #include #include #include int main() { const char file[] = "/tmp/.afunix"; umask(0077); int status = unlink(file); if (status < 0 && errno != ENOENT) { printf("unlink() failed with %d\n", errno); return 1; } int fd = socket(AF_UNIX, SOCK_STREAM, 0); if (fd < 0) { printf("socket() failed with %d\n", errno); return 1; } struct sockaddr_un address; memset(&address, 0, sizeof(address)); address.sun_family = AF_UNIX; strcpy(address.sun_path, file); int len = sizeof(address); status = bind(fd, (sockaddr*) &address, len); if (status < 0) { printf("bind() failed with %d\n", errno); return 1; } status = chmod(file, 0777); if (status < 0) { printf("chmod() failed with %d\n", errno); return 1; } return 0; } --Boundary_(ID_DcAPNjcZ/GC9naH3EkNfFA) Content-Type: text/plain; charset=us-ascii -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/ --Boundary_(ID_DcAPNjcZ/GC9naH3EkNfFA)--