1
0
mirror of https://github.com/ostreedev/ostree.git synced 2025-01-12 13:18:27 +03:00

Merge pull request from alexlarsson/fix-fsverity-error-check

_ostree_ensure_fsverity: Properly check for errors
This commit is contained in:
Colin Walters 2024-04-08 12:40:03 -04:00 committed by GitHub
commit 3c2e9d0974
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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)
{
@ -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;
}