Skip to content

Filesystem sync errors unchecked #7629

@LeeBrotherston

Description

@LeeBrotherston

Observed behavior

There are multiple places in server/filestore.go where the file .Sync() call is used:

https://github.com/search?q=repo%3Anats-io%2Fnats-server%20%22.Sync()%22%20path%3Aserver%2Ffilestore.go&type=code

This call returns an error, or nil if no error: https://pkg.go.dev/os#File.Sync

However, this is not checked in the code, thus if the .Sync() call were to fail, then it would not be detected in the code and it would carry on.

Expected behavior

The code should check the return value and handle errors appropriately.

Server and client version

n/a - in current main branch

Host environment

n/a - in current main branch

Steps to reproduce

Examine the source code and compare to the go documentation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    defectSuspected defect such as a bug or regression

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions