Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
Trac
Trac
  • Project overview
    • Project overview
    • Details
    • Activity
  • Issues 246
    • Issues 246
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Operations
    • Operations
    • Metrics
    • Incidents
  • Analytics
    • Analytics
    • Value Stream
  • Wiki
    • Wiki
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Create a new issue
  • Issue Boards

GitLab is used only for code review, issue tracking and project management. Canonical locations for source code are still https://gitweb.torproject.org/ https://git.torproject.org/ and git-rw.torproject.org.

  • Legacy
  • TracTrac
  • Issues
  • #5762

Closed (moved)
Open
Opened May 03, 2012 by Roger Dingledine@arma

SOCK_CLOEXEC should get ENOSYS, not EINVAL, on accept()

In #5112 (moved) we added a bunch of checks to ignore open(), accept4(), etc failures if errno is EINVAL.

But it would appear the accept4() sets errno to ENOSYS, not EINVAL, if the system lacks O_CLOEXEC support.

A quick google led me to https://projects.honeynet.org/svn/sebek/virtualization/qebek/trunk/osdep.c which handles EINVAL in most cases but ENOSYS in the accept4() case.

Here's the simple patch, but it probably wants a changes stanza and a much better explanation in the comment if we like it:

diff --git a/src/common/compat.c b/src/common/compat.c
index fbb37ce..490deea 100644
--- a/src/common/compat.c
+++ b/src/common/compat.c
@@ -1016,7 +1016,7 @@ tor_accept_socket(tor_socket_t sockfd, struct sockaddr *
   /* If we got an error, see if it is EINVAL. EINVAL might indicate that,
    * event though we were built on a system with accept4 support, we
    * are running on one without. */
-  if (errno != EINVAL)
+  if (errno != ENOSYS)
     return s;
 #endif

See also http://osdir.com/ml/ruby-talk/2012-03/msg00082.html

Reported by murb.

To upload designs, you'll need to enable LFS and have admin enable hashed storage. More information
Assignee
Assign to
Tor: 0.2.3.x-final
Milestone
Tor: 0.2.3.x-final
Assign milestone
Time tracking
None
Due date
None
Reference: legacy/trac#5762