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

_ostree_ensure_fsverity: Properly check for errors #3227

Merged
merged 1 commit into from
Apr 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/libostree/ostree-repo-verity.c
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,10 @@ _ostree_tmpf_fsverity (OstreeRepo *self, GLnxTmpfile *tmpf, GBytes *signature, G

gboolean
_ostree_ensure_fsverity (OstreeRepo *self, gboolean allow_enoent, int dirfd, const char *path,
gboolean *supported, GError **error)
gboolean *supported_out, GError **error)
{
struct stat buf;
gboolean supported;

if (fstatat (dirfd, path, &buf, AT_SYMLINK_NOFOLLOW) != 0)
{
Expand All @@ -243,11 +244,14 @@ _ostree_ensure_fsverity (OstreeRepo *self, gboolean allow_enoent, int dirfd, con
if (fd < 0)
return glnx_throw_errno_prefix (error, "openat(%s)", path);

if (!_ostree_fsverity_enable (fd, TRUE, supported, NULL, error))
if (!_ostree_fsverity_enable (fd, TRUE, &supported, NULL, error))
return FALSE;

if (!supported && self->fs_verity_wanted == _OSTREE_FEATURE_YES)
return glnx_throw (error, "fsverity required but filesystem does not support it");

if (supported_out)
*supported_out = supported;

return TRUE;
}
Loading