From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12141 invoked by alias); 21 Aug 2014 16:17:05 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 12128 invoked by uid 89); 21 Aug 2014 16:17:04 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mailout10.t-online.de Received: from mailout10.t-online.de (HELO mailout10.t-online.de) (194.25.134.21) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Thu, 21 Aug 2014 16:17:03 +0000 Received: from fwd02.aul.t-online.de (fwd02.aul.t-online.de [172.20.26.148]) by mailout10.t-online.de (Postfix) with SMTP id 4509450C1C7 for ; Thu, 21 Aug 2014 18:16:59 +0200 (CEST) Received: from [192.168.2.108] (TDth9mZZghCCFAep86G8edblRoSj53fmOJ5Flj2Q1NXUvT+2IU2YLh5ztezvKGuQDn@[79.224.124.210]) by fwd02.t-online.de with (TLSv1.2:ECDHE-RSA-AES256-SHA encrypted) esmtp id 1XKV2f-17dlwW0; Thu, 21 Aug 2014 18:16:49 +0200 Message-ID: <53F61B70.2020600@t-online.de> Date: Thu, 21 Aug 2014 16:17:00 -0000 From: Christian Franke User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:29.0) Gecko/20100101 Firefox/29.0 SeaMonkey/2.26.1 MIME-Version: 1.0 To: cygwin@cygwin.com Subject: connect() hangs on a listen()ing AF_UNIX socket Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2014-08/txt/msg00420.txt.bz2 Corinna Vinschen wrote (in thread "[ITP] libsuexec 1.0"): > Postfix for Cygwin would be *so* nice. Sigh. ... Due to the following problem, Postfix hangs during startup (and blocks any possible "[ITP] postfix ..."): If a AF_UNIX socket is in listen()ing state, a client connect() should succeed immediately. On Cygwin, connect() waits until the server site accept()s the connection. Testcase: #include #include #include #include int main() { sockaddr_un sa = {AF_UNIX, "testsocket"}; unlink(sa.sun_path); int sd1 = socket(AF_UNIX, SOCK_STREAM, 0); if (sd1 < 0) { perror("socket"); return 1; } if (bind(sd1, (sockaddr*) &sa, sizeof(sa))) { perror("bind"); return 1; } if (listen(sd1, 10) < 0) { perror("listen"); return 1; } int sd2 = socket(AF_UNIX, SOCK_STREAM, 0); if (sd2 < 0) { perror("socket"); return 1; } printf("connecting to %s ...\n", sa.sun_path); // Cygwin hangs here: if (connect(sd2, (sockaddr*) &sa, sizeof(sa))) { perror("connect"); return 1; } // Linux & friends arrive here: printf("connected\n"); return 0; } This is likely because fhandler_socket::af_local_connect() waits for some secret. Sending it in af_local_accept() is too late in this case. Unfortunately the event handling of postfix relies on the correct behavior and there is possibly no easy workaround. Christian -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple