mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-20 23:30:14 +01:00
Fix time of check/use Coverity report in veritysetup.
This commit is contained in:
@@ -78,17 +78,15 @@ static int action_format(int arg)
|
|||||||
struct crypt_device *cd = NULL;
|
struct crypt_device *cd = NULL;
|
||||||
struct crypt_params_verity params = {};
|
struct crypt_params_verity params = {};
|
||||||
uint32_t flags = CRYPT_VERITY_CREATE_HASH;
|
uint32_t flags = CRYPT_VERITY_CREATE_HASH;
|
||||||
struct stat st;
|
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
/* Try to create hash image if doesn't exist */
|
/* Try to create hash image if doesn't exist */
|
||||||
if (stat(action_argv[1], &st) < 0) {
|
r = open(action_argv[1], O_WRONLY | O_EXCL | O_CREAT, S_IRUSR | S_IWUSR);
|
||||||
log_dbg("Creating hash image %s.", action_argv[1]);
|
if (r < 0 && errno != EEXIST) {
|
||||||
r = open(action_argv[1], O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR);
|
log_err(_("Cannot create hash image %s for writing.\n"), action_argv[1]);
|
||||||
if (r < 0) {
|
return -EINVAL;
|
||||||
log_err(_("Cannot create hash image %s for writing.\n"), action_argv[1]);
|
} else if (r >= 0) {
|
||||||
return -EINVAL;
|
log_dbg("Created hash image %s.", action_argv[1]);
|
||||||
}
|
|
||||||
close(r);
|
close(r);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user