delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2003/04/21/16:20:24

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
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: Mon, 21 Apr 2003 22:20:02 +0200
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: ENOTSOCK errors with cygwin dll 1.3.21 and 1.3.22
Message-ID: <20030421202002.GD11137@cygbert.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <Pine DOT GSO DOT 4 DOT 44 DOT 0304141917120 DOT 26381-100000 AT slinky DOT cs DOT nyu DOT edu> <008301c30494$3ac5ac50$0200a8c0 AT abackusdell2>
Mime-Version: 1.0
In-Reply-To: <008301c30494$3ac5ac50$0200a8c0@abackusdell2>
User-Agent: Mutt/1.4.1i

On Wed, Apr 16, 2003 at 08:48:37PM -0700, Abraham Backus wrote:
> Thanks Igor.  I've downloaded the cygwin cvs and am trying to track down
> what's up in any spare time that I get.  In the meantime though, I've copied
> some code from a testcase for one of the patches and made some of my own
> modifications to run it using inetd.  With 1.3.20, the code is ok.  With
> 1.3.22 however, the calls to fgets(), fputs(), and fflush() all fail with
> "Socket operation on non-socket" (errno=ENOTSOCK)

I've tested your below small aplication on XP using all versions from
1.3.20 up to current from CVS.  Actually it worked not very well on
1.3.20 (the both "yo" replies never made it to the client) while it
worked nicely on all versions since 1.3.21.

For the records, I used the following entry in /etc/inetd.conf:

  uucp    stream  tcp     nowait  root    /home/corinna/socktest socktest

I used uucp just to have some known service.  Then I connected using
`telnet localhost uucp'.

Corinna

> ----- Original Message -----
> 
> > Look in winsup/cygwin/ChangeLog between "Bump DLL minor number to 22" and
> > "Bump DLL minor number to 23"...  You could also look in the cygwin-cvs
> > list archives between 3/9 and 3/13.
> >
> > FWIW, I see the following socket-related changes:
> > <http://cygwin.com/ml/cygwin-cvs/2003-q1/msg00359.html>
> > <http://cygwin.com/ml/cygwin-cvs/2003-q1/msg00352.html>
> > <http://cygwin.com/ml/cygwin-cvs/2003-q1/msg00350.html>
> > but I might have missed something...

> #include <syslog.h>
> #include <errno.h>
> #include <sys/stat.h>
> #include <sys/types.h>
> #include <stdio.h>
> #include <string.h>
> 
> void checkIsSocket(int fd)
> {
> 	struct stat buf;
> 	memset(&buf, 0, sizeof (buf));
> 	if (fstat(fd, &buf) < 0)
> 	{
> 		syslog(LOG_INFO, "fstat() failed with %d\n", errno);
> 		return;
> 	}
> 
> 	if (S_ISSOCK(buf.st_mode))
> 	{
> 		syslog(LOG_INFO, "fd %d is a socket\n", fd);
> 	}
> 	else
> 	{
> 		syslog(LOG_INFO, "fd %d is not a socket\n", fd);
> 	}
> }
> 
> int main()
> {
> 	checkIsSocket(0);
> 	checkIsSocket(1);
> 	checkIsSocket(2);
> 
> 	char buf[1024];
> 	if (NULL == fgets(buf, 1024, stdin))
> 	{
> 		syslog(LOG_INFO, "stdin %s", strerror(errno));
> 	}
> 	if (EOF == fputs("yo", stdout))
> 	{
> 		syslog(LOG_INFO, "stdout %s", strerror(errno));
> 	}
> 	else
> 	{
> 		if (EOF == fflush(stdout))
> 		{
> 			syslog(LOG_INFO, "stdout flush %s", strerror(errno));
> 		}
> 	}
> 	if (EOF == fputs("yo", stderr))
> 	{
> 		syslog(LOG_INFO, "stderr %s", strerror(errno));
> 	}
> 	else
> 	{
> 		if (EOF == fflush(stderr))
> 		{
> 			syslog(LOG_INFO, "stderr flush %s", strerror(errno));
> 		}
> 	}
> }
> 

> --
> Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
> Problem reports:       http://cygwin.com/problems.html
> Documentation:         http://cygwin.com/docs.html
> FAQ:                   http://cygwin.com/faq/

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Developer                                mailto:cygwin AT cygwin DOT com
Red Hat, Inc.

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019