delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/10/13/06:35:10

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/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
Message-ID: <416D0506.D77FEF77@dessent.net>
Date: Wed, 13 Oct 2004 03:35:50 -0700
From: Brian Dessent <brian AT dessent DOT net>
Organization: My own little world...
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: other services ok, ftp not (was 1.5.11 - tcp problems)
References: <4745850620 DOT 20040921112624 AT scenta DOT co DOT uk> <416B3A95 DOT 4010506 AT hq DOT astra DOT ph> <Pine DOT GSO DOT 4 DOT 61 DOT 0410121150090 DOT 24643 AT slinky DOT cs DOT nyu DOT edu> <416C92BD DOT 90100 AT hq DOT astra DOT ph> <416CC006 DOT 3D4ECDEF AT dessent DOT net> <416CC105 DOT B1C945CA AT dessent DOT net> <416CF9FA DOT 6010209 AT hq DOT astra DOT ph>
X-IsSubscribed: yes
Reply-To: cygwin AT cygwin DOT com

Carlo Florendo wrote:

> Anyway, I got this error:
> 
> getservbyname() returned NULL: win32 error 11004

Googling shows that this is consistent with trying to run a
program/server that tries to look up its port in the services file when
no such matching line exists.

> I also read the message regarding the \r\n and \n line endings (still
> not in my mailbox) and Corinna's reply.  I've checked the services file
> and confirmed that the line endings are \r\n  (with the simple test of
> ^M showing up when invoking `vim -b'.  Notepad also views the file
> correctly, thus it's really \r\n.).
> 
> I'm confident we're getting close!

Closer yes, but I'm afraid I don't have much else coming to mind. 
Everything indicates that it's not finding what it's looking for in the
services file.  Maybe some spaces got replaced by tabs and windows
cannot cope?  Maybe your cat walked across the keyboard when you had the
file open in an editor?  :-)  Try the minimal services file necessary:

cd `cygpath -u $SYSTEMROOT/system32/drivers/etc`
mv services services.bak
echo "ftp 21/tcp" >services   # according to corinna there's no need for
\r here

If that fixes the testcase then gradually add back the rest of the stuff
in the file until you figure out what it is that's causing it to fail.

One thing is clear though, this is not a Cygwin problem.  The mingw
example shows a minimal testcase that involves no Cygwin code at all,
just direct calls to the Winsock functions.  I'm willing to bet if you
found a regular windows application that tried to look up a port using
getservbyname() it would fail in the same way.  This is a relatively
rare/antiquated thing to do as most apps either have the port
configurable via a URL or a config file, or they just hard-code it.

If you want a quick and dirty solution, comment out the call to
getservbyname in the ftp source code and modify it to assume port 21. 
But that's admitting defeat, really.

Brian

--
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