Skip to content

Convert file permission hex constants to octal#1007

Merged
dgarske merged 1 commit into
wolfSSL:masterfrom
ejohnstown:hex2octal
Jun 9, 2026
Merged

Convert file permission hex constants to octal#1007
dgarske merged 1 commit into
wolfSSL:masterfrom
ejohnstown:hex2octal

Conversation

@ejohnstown

Copy link
Copy Markdown
Contributor

Replace hex literals (0x1ED, 0x124, 0x4000, etc.) with octal equivalents (0755, 0444, 040000) in SCP/SFTP attribute handling

Copilot AI review requested due to automatic review settings June 8, 2026 17:08

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 thread src/wolfsftp.c Outdated
- Replace hex literals (0x1ED, 0x124, 0x4000, etc.) with octal
  equivalents (0755, 0444, 040000) in SCP/SFTP attribute handling
@dgarske dgarske merged commit ba09b58 into wolfSSL:master Jun 9, 2026
125 checks passed
@ejohnstown ejohnstown deleted the hex2octal branch June 9, 2026 21:42
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.

4 participants