Skip to content

fix(update): check dir writability to avoid ETXTBSY on running binary#46

Merged
aJesus37 merged 1 commit into
mainfrom
fix/update-etxtbsy
Mar 21, 2026
Merged

fix(update): check dir writability to avoid ETXTBSY on running binary#46
aJesus37 merged 1 commit into
mainfrom
fix/update-etxtbsy

Conversation

@aJesus37

Copy link
Copy Markdown
Owner

Problem

canWriteExec tried to open the running binary with O_WRONLY, which always fails on Linux with ETXTBSY (text file busy), causing hctf update to unnecessarily escalate to sudo even when the user owns the binary.

Fix

Probe writability by creating a temp file in the same directory instead, then immediately removing it. This correctly reflects whether the user can write to that location without touching the binary itself.

@aJesus37
aJesus37 merged commit 9a7c337 into main Mar 21, 2026
5 checks passed
@aJesus37
aJesus37 deleted the fix/update-etxtbsy branch March 21, 2026 02:38
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