Skip to content

std.os: don't always retry close() on EINTR #2425

@daurnimator

Description

@daurnimator

At the moment, close is retried on EINTR.

zig/std/os.zig

Line 270 in f479829

posix.EINTR => continue,

On many operating systems, you shouldn't do this. e.g. From linux man page:

In particular close() should not be retried after an EINTR since this may cause a reused descriptor from another thread to be closed.

If my earlier research is correct:

  • HP-UX you try again
  • Linux, Solaris and AIX you don't want to retry again
  • OSX is ill-defined and hence unsafe, you should use close_nocancel instead and not try again.

Related links:

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugObserved behavior contradicts documented or intended behaviorstandard libraryThis issue involves writing Zig code for the standard library.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions