Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #87, Check return value of stat() #125

Merged
merged 1 commit into from
Jul 2, 2024

Conversation

thnkslprpt
Copy link
Contributor

@thnkslprpt thnkslprpt commented Nov 12, 2022

Checklist

Describe the contribution

  • Fixes Check Return Value of stat #87
    • Adds a check for the return value of stat in case of error return, and prints an error message.
      • Does not return FAILURE, as the chmod may well have been successful, and following this there is only an informational message (about the file permissions).

Testing performed
GitHub CI actions (incl. Codeql Build etc.) all passing successfully excl. CodeQL-security for apparently pre-existing issues that are being flagged now.

Expected behavior changes
No impact on behavior.
Adds error message for an (unlikely) error return from stat().

Contributor Info
Avi Weiss @thnkslprpt

if (Verbose)
printf("%s: Destination file permissions after open = 0x%X\n", DstFilename, dststat.st_mode);
chmod(DstFilename, dststat.st_mode & ~(S_IRGRP | S_IWGRP | S_IXGRP | S_IROTH | S_IWOTH | S_IXOTH));
stat(DstFilename, &dststat);

if (stat(DstFilename, &dststat) != 0)

Check warning

Code scanning / CodeQL-coding-standard

Side effect in a Boolean expression

This Boolean expression is not side-effect free.
@dzbaker dzbaker added this to the Fornax milestone Nov 21, 2022
@dzbaker dzbaker modified the milestones: Fornax, Equuleus Dec 7, 2022
@dzbaker dzbaker added CCB:Approved Indicates code approval by CCB and removed CCB:Ready labels May 30, 2024
dzbaker added a commit to nasa/cFS that referenced this pull request Jul 2, 2024
*Combines:*

cFE equuleus-rc1+dev137
osal equuleus-rc1+dev66
elf2cfetbl equuleus-rc1+dev56

**Includes:**

*cFS*
- #707
- #773

*cFE*
- nasa/cFE#2560
- nasa/cFE#2344
- nasa/cFE#2359
- nasa/cFE#2376
- nasa/cFE#2496
- nasa/cFE#2554
- nasa/cFE#2568
- nasa/cFE#2566

*osal*
- nasa/osal#1456
- nasa/osal#1465

*elf2cfetbl*
- nasa/elf2cfetbl#147
- nasa/elf2cfetbl#124
- nasa/elf2cfetbl#125
- nasa/elf2cfetbl#127

Co-authored by: Avi Weiss <thnkslprpt@users.noreply.github.com>
Co-authored by: Justin Figueroa <chillfig@users.noreply.github.com>
Co-authored by: Joseph Hickey <jphickey@users.noreply.github.com>
Co-authored by: Jacob Hageman <skliper@users.noreply.github.com>
Co-authored by: Anh Van <avan989@users.noreply.github.com>
@dzbaker dzbaker mentioned this pull request Jul 2, 2024
2 tasks
dzbaker added a commit to nasa/cFS that referenced this pull request Jul 2, 2024
*Combines:*

cFE equuleus-rc1+dev137
osal equuleus-rc1+dev66
elf2cfetbl equuleus-rc1+dev56

**Includes:**

*cFS*
- #707
- #773

*cFE*
- nasa/cFE#2560
- nasa/cFE#2344
- nasa/cFE#2359
- nasa/cFE#2376
- nasa/cFE#2496
- nasa/cFE#2554
- nasa/cFE#2568
- nasa/cFE#2566

*osal*
- nasa/osal#1456
- nasa/osal#1465

*elf2cfetbl*
- nasa/elf2cfetbl#147
- nasa/elf2cfetbl#124
- nasa/elf2cfetbl#125
- nasa/elf2cfetbl#127

Co-authored by: Avi Weiss <thnkslprpt@users.noreply.github.com>
Co-authored by: Justin Figueroa <chillfig@users.noreply.github.com>
Co-authored by: Joseph Hickey <jphickey@users.noreply.github.com>
Co-authored by: Jacob Hageman <skliper@users.noreply.github.com>
Co-authored by: Anh Van <avan989@users.noreply.github.com>
@dzbaker dzbaker merged commit 1ca5d27 into nasa:main Jul 2, 2024
dzbaker added a commit to nasa/cFS that referenced this pull request Jul 2, 2024
*Combines:*

cFE equuleus-rc1+dev137
osal equuleus-rc1+dev66
elf2cfetbl equuleus-rc1+dev56

**Includes:**

*cFS*
- #707
- #773

*cFE*
- nasa/cFE#2560
- nasa/cFE#2344
- nasa/cFE#2359
- nasa/cFE#2376
- nasa/cFE#2496
- nasa/cFE#2554
- nasa/cFE#2568
- nasa/cFE#2566

*osal*
- nasa/osal#1456
- nasa/osal#1465

*elf2cfetbl*
- nasa/elf2cfetbl#147
- nasa/elf2cfetbl#124
- nasa/elf2cfetbl#125
- nasa/elf2cfetbl#127

Co-authored by: Avi Weiss <thnkslprpt@users.noreply.github.com>
Co-authored by: Justin Figueroa <chillfig@users.noreply.github.com>
Co-authored by: Joseph Hickey <jphickey@users.noreply.github.com>
Co-authored by: Jacob Hageman <skliper@users.noreply.github.com>
Co-authored by: Anh Van <avan989@users.noreply.github.com>
@thnkslprpt thnkslprpt deleted the fix-87-check-return-value-of-stat branch July 3, 2024 05:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CCB:Approved Indicates code approval by CCB
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Check Return Value of stat
3 participants