code cleanup related to devfd checks

alter all checks for devfd value after device_open to
less than zero insted of equals to -1. device_open will
return values different from -1 in case error happens.

In LUKSv1 device_open should always return -1 in case of
error but this check is safer.

The rest is just formating improvement.
This commit is contained in:
Ondrej Kozina
2016-06-07 11:21:15 +02:00
committed by Milan Broz
parent f397d42d73
commit 16fab74ab1
5 changed files with 18 additions and 18 deletions

View File

@@ -166,7 +166,7 @@ int crypt_wipe(struct device *device,
/* coverity[toctou] */
devfd = device_open(device, flags);
if (devfd == -1) {
if (devfd < 0) {
free(buffer);
return errno ? -errno : -EINVAL;
}