Skip to content

Conversation

@stefanberger
Copy link
Owner

To support writing state files atomically we first write into
a temporary file and then rename it.

Signed-off-by: Stefan Berger stefanb@linux.ibm.com

@coveralls
Copy link

coveralls commented Oct 2, 2020

Pull Request Test Coverage Report for Build 2718

  • 9 of 15 (60.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.007%) to 73.653%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/swtpm/swtpm_nvfile.c 9 15 60.0%
Totals Coverage Status
Change from base Build 2712: -0.007%
Covered Lines: 3732
Relevant Lines: 5067

💛 - Coveralls

Copy link

@mz-pdm mz-pdm left a comment

Choose a reason for hiding this comment

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

FWIW it looks good to me.

n = snprintf(filename, bufsize, "%s/tpm%s-%02lx.%s",
state_directory, suffix, (unsigned long)tpm_number, name);
if (is_tempfile) {
n = snprintf(filename, bufsize, "%s/TPM%s-%02lx.%s",
Copy link

Choose a reason for hiding this comment

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

I hope that nobody ever gets an idea to run swtpm on a case-insensitive file system...

Copy link
Owner Author

Choose a reason for hiding this comment

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

Will change this to TMP :-)

To support writing state files atomically we first write into
a temporary file and then rename it.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
@stefanberger stefanberger merged commit 3fde803 into master Oct 5, 2020
@stefanberger stefanberger deleted the atomic_file_write branch October 5, 2020 14:18
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