Skip to content

Send SIGPIPE when writing to a closed pipe/socket #161

@amscanne

Description

@amscanne

man 2 write:

"EPIPE fd is connected to a pipe or socket whose reading end is closed. When this happens the writing process will also receive a SIGPIPE signal. (Thus, the write return value is seen only if the program catches, blocks or ignores this signal.)"

As is typical, the man page oversimplifies things. For sockets there are three different behaviors (that I've found so far):

SOCK_STREAM: returns EPIPE and sends SIGPIPE
SOCK_SEQPACKET: returns EPIPE and does not send SIGPIPE
SOCK_DGRAM: return ECONNREFUSED and does not send SIGPIPE

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: filesystemIssue related to filesystemarea: networkingIssue related to networkingexportedIssue was exported automaticallypriority: p2Normal prioritytype: cleanupRefactorings and cleanups to improve the codetype: enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions