Convert file permission hex constants to octal#1007
Open
ejohnstown wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves readability of SCP/SFTP permission handling by converting several file-mode and attribute bitmask literals from hexadecimal to their equivalent octal forms, aligning with how UNIX-style permission bits are typically expressed.
Changes:
- Replaced hex permission constants (e.g.,
0x124,0x1ED,0x41ED,0x4000,0x8000,0x1FF) with equivalent octal literals (0444,0755,040755,040000,0100000,0777) across SFTP/SCP code paths. - Updated a unit test to use the octal directory-bit check (
040000). - Simplified the Microchip Harmony
wChmod()read-only detection mask from hex to octal.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
wolfssh/port.h |
Uses octal 0444 instead of hex for read-only mode comparisons in platform chmod shims. |
tests/api.c |
Updates directory-bit masking in the SFTP read packet test to octal (040000). |
src/wolfsftp.c |
Converts multiple SFTP attribute permission/type constants to octal for clearer POSIX-style mode encoding. |
src/wolfscp.c |
Converts SCP file-mode constants (including directory type bit) from hex to octal. |
src/port.c |
Converts Microchip Harmony wChmod() permission mask logic from hex to octal. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+5263
to
+5264
| atr->per |= 040755; | ||
| atr->per |= 0755; |
- Replace hex literals (0x1ED, 0x124, 0x4000, etc.) with octal equivalents (0755, 0444, 040000) in SCP/SFTP attribute handling
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replace hex literals (0x1ED, 0x124, 0x4000, etc.) with octal equivalents (0755, 0444, 040000) in SCP/SFTP attribute handling