Skip to content

Detach does not send MSG_DETACH — stale attached status in list #7

@DonaldoDes

Description

@DonaldoDes

Description

When pressing the detach character (Ctrl+), the client prints the detach message and calls exit(0) without sending MSG_DETACH to the master. The master only learns about the disconnect via EOF on the socket, creating a race condition where atch list can show the session as [attached] after detach.

Reproduction

  1. Create session1 and session2
  2. Attach session1, detach (Ctrl+)
  3. Attach session2, detach (Ctrl+)
  4. atch list → session2 may still show [attached]

Root cause

process_kbd in attach.c calls exit(0) on detach_char without first sending MSG_DETACH to the master. The VSUSP path correctly sends the message, but the detach path does not.

Suggested fix

Send MSG_DETACH to the master socket before exit(0) in the detach_char handler.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions