From 6c2760c9cd927efa6cbe4240b82363e176742323 Mon Sep 17 00:00:00 2001 From: Ondrej Kozina Date: Thu, 25 Apr 2019 18:56:05 +0200 Subject: [PATCH] Report data sync errors from storage wrapper. --- lib/utils_storage_wrappers.c | 8 ++++---- lib/utils_storage_wrappers.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/utils_storage_wrappers.c b/lib/utils_storage_wrappers.c index 96be9cd9..433af2c7 100644 --- a/lib/utils_storage_wrappers.c +++ b/lib/utils_storage_wrappers.c @@ -383,14 +383,14 @@ void crypt_storage_wrapper_destroy(struct crypt_storage_wrapper *cw) free(cw); } -void crypt_storage_wrapper_datasync(const struct crypt_storage_wrapper *cw) +int crypt_storage_wrapper_datasync(const struct crypt_storage_wrapper *cw) { if (!cw) - return; + return -EINVAL; if (cw->type == DMCRYPT) - fdatasync(cw->u.dm.dmcrypt_fd); + return fdatasync(cw->u.dm.dmcrypt_fd); else - fdatasync(cw->dev_fd); + return fdatasync(cw->dev_fd); } crypt_storage_wrapper_type crypt_storage_wrapper_get_type(const struct crypt_storage_wrapper *cw) diff --git a/lib/utils_storage_wrappers.h b/lib/utils_storage_wrappers.h index d98f970b..46ac8533 100644 --- a/lib/utils_storage_wrappers.h +++ b/lib/utils_storage_wrappers.h @@ -65,7 +65,7 @@ ssize_t crypt_storage_wrapper_encrypt_write(struct crypt_storage_wrapper *cw, ssize_t crypt_storage_wrapper_encrypt(struct crypt_storage_wrapper *cw, off_t offset, void *buffer, size_t buffer_length); -void crypt_storage_wrapper_datasync(const struct crypt_storage_wrapper *cw); +int crypt_storage_wrapper_datasync(const struct crypt_storage_wrapper *cw); crypt_storage_wrapper_type crypt_storage_wrapper_get_type(const struct crypt_storage_wrapper *cw); #endif