From: Corinna Vinschen <cygwin@cygwin.com>
To: cygwin@cygwin.com
Subject: Re: duplicate regexec/regcomp functions detected
Date: Tue, 01 Jan 2002 07:07:00 -0000 [thread overview]
Message-ID: <20020101160631.B27340@cygbert.vinschen.de> (raw)
In-Reply-To: <000a01c1922c$6f5d5b10$865c07d5@BRAMSCHE>
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 <stdio.h>
#include <errno.h>
#include <sys/socket.h>
#include <sys/un.h>
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 = <some random string here>, 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/
next prev parent reply other threads:[~2002-01-01 15:07 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-12-13 12:48 Ralf Habacker
2001-12-14 2:40 ` Corinna Vinschen
2001-12-27 10:20 ` Ralf Habacker
2001-12-27 10:21 ` Christopher Faylor
2001-12-28 5:21 ` Ralf Habacker
2001-12-28 5:22 ` Robert Collins
2001-12-28 10:17 ` Christopher Faylor
2001-12-29 12:43 ` Ralf Habacker
2001-12-30 5:03 ` Christopher Faylor
2001-12-30 7:34 ` Ralf Habacker
2001-12-30 11:56 ` Christopher Faylor
2001-12-31 11:19 ` Ralf Habacker
2002-01-01 7:07 ` Corinna Vinschen [this message]
2002-01-01 16:00 ` Ralf Habacker
2002-01-02 2:04 ` Corinna Vinschen
2002-01-02 2:11 ` Ralf Habacker
2001-12-29 14:15 ` Ralf Habacker
2001-12-29 16:40 ` Ralf Habacker
2001-12-30 14:35 ` Christopher Faylor
2001-12-30 16:42 ` Christopher Faylor
2001-12-31 1:16 ` Christopher Faylor
2001-12-31 2:42 ` Ralf Habacker
2001-12-31 11:06 ` Christopher Faylor
2001-12-31 12:04 ` Ralf Habacker
2001-12-31 14:12 ` Christopher Faylor
[not found] <01df01c19259$1cbb8300$0200a8c0@lifelesswks>
2002-01-01 6:27 ` Ralf Habacker
2002-01-01 9:26 ` Christopher Faylor
2002-01-01 9:53 ` Corinna Vinschen
2002-01-01 10:30 ` Christopher Faylor
2002-01-01 13:56 ` Ralf Habacker
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20020101160631.B27340@cygbert.vinschen.de \
--to=cygwin@cygwin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).