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

logger: fix file open issue if crypto algorithm is disabled #857

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jnippula
Copy link

Create empty file even if crypto key is not stored into the beginning of the log file to allow file logger to always append log data into existing file.

@jnippula jnippula requested review from kordets and jlaitine December 27, 2024 10:23
Copy link

@jlaitine jlaitine left a comment

Choose a reason for hiding this comment

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

This looks a bit weird, is it so that the file might be created in two places?

Copy link

@jlaitine jlaitine left a comment

Choose a reason for hiding this comment

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

That is, should we really just push the key to the _buffers and let the file creation be only there?

@jnippula jnippula force-pushed the fix-logger-no-crypto branch from 9188888 to b0a780b Compare December 30, 2024 13:41
@jnippula
Copy link
Author

jnippula commented Dec 30, 2024

Right, it was a bit confusing where and when the file is opened and how. Original idea was to create file already in init_logfile_encryption() even there is no key data (no_crypto) and then start_log would any case open file as append.

Anyway, I made it now a bit different way: init_logfile_encryption() now gets keydata/keydatasize as param, allocate memory and store keydata there. Later the LogFileBuffer::start_log() gets the keydata buffer and if any data exists, it stores the keydata into the beginning of the recently opened file. How that looks?

Store keydata into memory buffer in init phase. If keydata exists,
write it into the beginning of the file when file is opened in
LogFileBuffer::start_log()
@jnippula jnippula force-pushed the fix-logger-no-crypto branch from b0a780b to eb54001 Compare December 31, 2024 08:06
@jnippula jnippula requested a review from jlaitine December 31, 2024 08:40
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.

2 participants