From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1034 invoked by alias); 1 Jan 2002 15:07:24 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Received: (qmail 1007 invoked from network); 1 Jan 2002 15:07:20 -0000 Received: from unknown (HELO cygnus.com) (205.180.230.5) by sources.redhat.com with SMTP; 1 Jan 2002 15:07:20 -0000 Received: from cygbert.vinschen.de (cse.cygnus.com [205.180.230.236]) by runyon.cygnus.com (8.8.7-cygnus/8.8.7) with ESMTP id HAA02608 for ; Tue, 1 Jan 2002 07:07:18 -0800 (PST) Received: (from corinna@localhost) by cygbert.vinschen.de (8.11.6/8.9.3/Linux sendmail 8.9.3) id g01F6VD16078 for cygwin@cygwin.com; Tue, 1 Jan 2002 16:06:31 +0100 Date: Tue, 01 Jan 2002 07:07:00 -0000 From: Corinna Vinschen To: cygwin@cygwin.com Subject: Re: duplicate regexec/regcomp functions detected Message-ID: <20020101160631.B27340@cygbert.vinschen.de> Mail-Followup-To: cygwin@cygwin.com References: <20011230184457.GA12386@redhat.com> <000a01c1922c$6f5d5b10$865c07d5@BRAMSCHE> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <000a01c1922c$6f5d5b10$865c07d5@BRAMSCHE> User-Agent: Mutt/1.3.22.1i X-SW-Source: 2002-01/txt/msg00006.txt.bz2 On Mon, Dec 31, 2001 at 07:53:28PM +0100, Ralf Habacker wrote: > > >- unix domain socket - The above mentioned os supports creating unix > > >domain sockets with previous existing files. On cygwin the unix domain > > >sockets couldn't be bound on existing files, so it has to be removed > > >first. > > > > Sounds like a bug. Submit a patch. It's not a bug, it's Linux compliant behaviour. Try the following code on Linux and Cygwin: ================================== SNIP ============================== #include #include #include #include int main(int argc, char **argv) { int sockfd; socklen_t len; struct sockaddr_un addr1, addr2; if (argc != 2) { fprintf (stderr, "Idiot\n"); return 1; } sockfd = socket (AF_LOCAL, SOCK_STREAM, 0); if (sockfd < 0) { fprintf (stderr, "socket: %d, %s\n", errno, strerror (errno)); return 1; } memset (&addr1, 0, sizeof addr1); addr1.sun_family = AF_LOCAL; strncpy (addr1.sun_path, argv[1], sizeof addr1.sun_path - 1); if (bind (sockfd, (struct sockaddr *) &addr1, SUN_LEN (&addr1)) < 0) { fprintf (stderr, "bind: %d, %s\n", errno, strerror (errno)); return 1; } len = sizeof addr2; if (getsockname (sockfd, (struct sockaddr *) &addr2, &len) < 0) { fprintf (stderr, "getsockname: %d, %s\n", errno, strerror (errno)); return 1; } printf ("bound name = %s, returned len = %d\n", addr2.sun_path, len); return 0; } ================================== SNAP ============================== Linux: ------ $ gcc -o uds uds.c $ ./uds /tmp/foo.bar bound name = /tmp/foo.bar, returned len = 15 $ ./uds /tmp/foo.bar bind: 98, Address already in use Cygwin: ------- $ gcc -o uds uds.c $ ./uds /tmp/foo.bar bound name = , returned len = 16 $ ./uds /tmp/foo.bar bind: 112, Address already in use That shows that Cygwin's getsockname() doesn't return a correct sockname for unix domain sockets but the bind() call behaves correct. An application that depends on (actually undocumented) behaviour that a unix domain socket can be rebound is doing something wrong. Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Developer mailto:cygwin@cygwin.com Red Hat, Inc. -- 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/