Skip to content

canbus: honor shutdown mode - #7

Open
Opriego wants to merge 1 commit into
jeremyhahn:masterfrom
Opriego:fix/canbus-shutdown-how
Open

canbus: honor shutdown mode#7
Opriego wants to merge 1 commit into
jeremyhahn:masterfrom
Opriego:fix/canbus-shutdown-how

Conversation

@Opriego

@Opriego Opriego commented Aug 17, 2026

Copy link
Copy Markdown

Summary

  • add a focused regression test for canbus_shutdown
  • forward the caller-provided shutdown mode to the socket syscall

Problem

canbus_shutdown accepts a how argument but ignores it and always calls
shutdown with SHUT_RD. Requests such as SHUT_WR or SHUT_RDWR therefore
have the wrong behavior.

Fix

Pass how to shutdown instead of the hard-coded SHUT_RD value.

Testing

The regression test wraps the socket syscall, calls canbus_shutdown with
SHUT_WR, and records the mode received by shutdown.

Before the fix:

0%: Checks: 1, Failures: 1, Errors: 0
shutdown received SHUT_RD (0) instead of SHUT_WR (1)

After the fix:

100%: Checks: 1, Failures: 0, Errors: 0

The existing socket descriptor comparison against NULL is unrelated and
remains unchanged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant