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

Do not open logfiles with read access #291

Closed
wants to merge 1 commit into from
Closed

Do not open logfiles with read access #291

wants to merge 1 commit into from

Conversation

cgzones
Copy link

@cgzones cgzones commented Nov 22, 2021

Currently logfiles are opened with read-access, due to cupsFileOpen()
converting "a" into O_RDWR | O_CREAT | O_APPEND. This should not be
necessary, as logfiles should be an append-only data structure.
Update cupsFileOpen() to open files with O_WRONLY | O_CREAT | O_APPEND
on mode "a" and add a fallback mode "a+" (see man:fopen(3)).
Currently only the logfiles and a test file are opened with "a".

Currently logfiles are opened with read-access, due to cupsFileOpen()
converting "a" into `O_RDWR | O_CREAT | O_APPEND`. This should not be
necessary, as logfiles should be an append-only data structure.
Update cupsFileOpen() to open files with `O_WRONLY | O_CREAT | O_APPEND`
on mode "a" and add a fallback mode "a+" (see man:fopen(3)).
Currently only the logfiles and a test file are opened with "a".
@michaelrsweet michaelrsweet self-requested a review November 22, 2021 12:52
@michaelrsweet michaelrsweet self-assigned this Nov 22, 2021
@michaelrsweet michaelrsweet added the investigating Investigating the issue label Nov 22, 2021
@michaelrsweet
Copy link
Member

@cgzones There was a reason for this but I haven’t touched this code in a long time. Will investigate…

Copy link
Member

@michaelrsweet michaelrsweet left a comment

Choose a reason for hiding this comment

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

No need to add "a+" to this, and all of the investigating I've done hasn't turned up anything useful as to why I used O_RDWR...

@michaelrsweet michaelrsweet added bug Something isn't working priority-low and removed investigating Investigating the issue labels May 4, 2022
@michaelrsweet michaelrsweet added this to the 2.4.2 milestone May 4, 2022
@michaelrsweet
Copy link
Member

[master 2a9c963] No longer use O_RDWR for append mode (Issue #291)

@cgzones cgzones deleted the no_read_log branch May 5, 2022 17:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working priority-low
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants