Defect report: ENOTSOCK on close

Christopher Yeleigton program.spe@home.pl
Tue Jan 15 09:17:00 GMT 2008


Summary:
Unexpected error ENOTSOCK upon closing filedes[0] obtained via socketpair

Test case:

#include <stdio.h>
#include <stdlib.h>
#include <sys/socket.h>

int main(int argc, char *argv[])
{
 auto int a_fd[02];
if(socketpair(AF_LOCAL, SOCK_STREAM, 0, a_fd))
 perror("socketpair");
 else
{
 auto int an_ix = 0;
 for(; an_ix < 02; ++an_ix)
 if(close(a_fd[an_ix]))
   { enum BufLen { BUF_LEN = 040 };
 auto char a_buf[BUF_LEN];
 perror(snprintf(a_buf, BUF_LEN, "close %d", an_ix) > 0? a_buf:
"sprintf"); }}
 return EXIT_SUCCESS; }

Error message:
close 0: Socket operation on non-socket

(Note it occurs with filedes[0] only, even if close is called for filedes[1]
first).

OpenBSD does not exhibit this malfunction.

Best regards,
Chris
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: cygcheck.txt
URL: <http://cygwin.com/pipermail/cygwin/attachments/20080115/dee09172/attachment.txt>
-------------- next part --------------
--
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/


More information about the Cygwin mailing list