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 Message-ID: <416CC006.3D4ECDEF@dessent.net> Date: Tue, 12 Oct 2004 22:41:26 -0700 From: Brian Dessent 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> <416C92BD DOT 90100 AT hq DOT astra DOT ph> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Reply-To: cygwin AT cygwin DOT com Carlo Florendo wrote: > File: inetutils-1.3.2-28 /ftp/main.c (line numbers preceed each line) > > 147 sp = getservbyname("ftp", "tcp"); > 148 if (sp == 0) > 149 errx(1, "ftp/tcp: unknown service"); Okay, so the 'SYSTEM' thing was a red herring, and you're just running this from a normal command prompt. Your SYSTEMROOT is set and nothing seems odd in your cygcheck, and permissions on the "services" file seem okay. Although I think your reasoning there is a little off-base: Cygwin itself does not attempt to access that file at all. Cygwin's getservbyname() just a straight passthru to the Winsock function of the same name which does the actual lookup. Try the following and see what happens: cat <getservbyname.c && \ gcc getservbyname.c -o getservbyname && ./getservbyname #include #include #include #include #include #include int main(int argc, char *argv[]) { struct servent *sv = getservbyname("ftp", "tcp"); if(sv) printf( "getservbyname() returned port %hu\n", ntohs(sv->s_port)); else printf( "getservbyname() returned NULL: %s\n", strerror(errno)); } ENDL Also try the following variant that will create a mingw version of the same test: cat <getservbyname-mingw.c && gcc -mno-cygwin \ getservbyname-mingw.c -o getservbyname-mingw && ./getservbyname-mingw #include #include #include #include #include int main(int argc, char *argv[]) { struct servent *sv; WORD wVersionRequested; WSADATA wsaData; int err; wVersionRequested = MAKEWORD( 2, 2 ); err = WSAStartup( wVersionRequested, &wsaData ); if( err != 0 ) { printf( "Unable to load ws2_32.dll: error %u\n", err); exit(1); } if( ( sv = getservbyname("ftp", "tcp") ) ) printf( "getservbyname() returned port %hu\n", ntohs(sv->s_port)); else printf( "getservbyname() returned NULL: win32 error %u\n", WSAGetLastError()); } ENDL Both of those should say "getservbyname() returned port 21". If either fails, paste the output. I suppose it's remotely possible that something's wrong with wsock32.dll or ws2_32.dll on your system, but if that was the case you'd have many more problems I'd think. 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/