Date: Thu, 24 Jul 2008 14:03:33 -0700 (PDT) From: Kian Mohageri <kian.mohageri@gmail.com> To: FreeBSD-gnats-submit@FreeBSD.org Subject: kern/125940: connect(2) returning -1, errno unset Message-ID: <200807242103.m6OL3XsK062925@dev.housing.wwu.edu> Resent-Message-ID: <200807242130.m6OLU2Kc081245@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 125940 >Category: kern >Synopsis: connect(2) returning -1, errno unset >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Thu Jul 24 21:30:02 UTC 2008 >Closed-Date: >Last-Modified: >Originator: Kian Mohageri >Release: FreeBSD 7.0-RELEASE-p3 i386 >Organization: >Environment: System: FreeBSD dev.housing.wwu.edu 7.0-RELEASE-p3 FreeBSD 7.0-RELEASE-p3 #0: Mon Jul 14 18:32:03 PDT 2008 root@dev.housing.wwu.edu:/usr/obj/usr/src/sys/GENERIC i386 >Description: Using FreeTDS 0.82 I ran into this issue. For some reason, the connection is failing (not sure why still). connect(2) is returning -1 to indicate failure, but errno is unset. The relevant code from freetds-0.82 follows: retval = connect(tds->s, (struct sockaddr *) &sin, sizeof(sin)); if (retval == 0) { tdsdump_log(TDS_DBG_INFO2, "connection established\n"); } else { tdsdump_log(TDS_DBG_ERROR, "tds_open_socket: connect(2) returned \"%s\"\n", strerror(sock_errno)); Debugging this further shows that retval is -1, but sock_errno (errno) is set to 0. Setting it to an arbitrary value prior to connect(2) reveals that it isn't touched at all after the failed connect(2). >How-To-Repeat: Not entirely sure how to repeat it in a more generic environment. This specific case is happening with php5-pdo_dblib, freetds-0.64 or freetds-0.82, and PHP via the command line. >Fix: >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200807242103.m6OL3XsK062925>