Use single flag to indicate 'no'flag
Signed-off-by: Dmitry Kasatkin <dmitry.kasatkin@huawei.com>
This commit is contained in:
parent
28d99354de
commit
e55d286ad6
16
src/evmctl.c
16
src/evmctl.c
@ -110,9 +110,9 @@ static int msize;
|
|||||||
static dev_t fs_dev;
|
static dev_t fs_dev;
|
||||||
static bool evm_immutable;
|
static bool evm_immutable;
|
||||||
|
|
||||||
#define HMAC_FLAG_UUID 0x0001
|
#define HMAC_FLAG_NO_UUID 0x0001
|
||||||
#define HMAC_FLAG_UUID_SET 0x0002
|
|
||||||
static unsigned long hmac_flags = HMAC_FLAG_UUID;
|
static unsigned long hmac_flags;
|
||||||
|
|
||||||
typedef int (*find_cb_t)(const char *path);
|
typedef int (*find_cb_t)(const char *path);
|
||||||
static int find(const char *path, int dts, find_cb_t func);
|
static int find(const char *path, int dts, find_cb_t func);
|
||||||
@ -275,7 +275,7 @@ static int get_uuid(struct stat *st, char *uuid)
|
|||||||
FILE *fp;
|
FILE *fp;
|
||||||
size_t len;
|
size_t len;
|
||||||
|
|
||||||
if (hmac_flags & HMAC_FLAG_UUID_SET)
|
if (uuid_str)
|
||||||
return pack_uuid(uuid_str, uuid);
|
return pack_uuid(uuid_str, uuid);
|
||||||
|
|
||||||
dev = st->st_dev;
|
dev = st->st_dev;
|
||||||
@ -419,7 +419,7 @@ static int calc_evm_hash(const char *file, unsigned char *hash)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!evm_immutable && (hmac_flags & HMAC_FLAG_UUID)) {
|
if (!evm_immutable && !(hmac_flags & HMAC_FLAG_NO_UUID)) {
|
||||||
err = get_uuid(&st, uuid);
|
err = get_uuid(&st, uuid);
|
||||||
if (err)
|
if (err)
|
||||||
return -1;
|
return -1;
|
||||||
@ -1585,10 +1585,8 @@ int main(int argc, char *argv[])
|
|||||||
break;
|
break;
|
||||||
case 'u':
|
case 'u':
|
||||||
uuid_str = optarg;
|
uuid_str = optarg;
|
||||||
if (uuid_str)
|
if (!uuid_str)
|
||||||
hmac_flags |= HMAC_FLAG_UUID_SET;
|
hmac_flags |= HMAC_FLAG_NO_UUID;
|
||||||
else
|
|
||||||
hmac_flags &= ~HMAC_FLAG_UUID;
|
|
||||||
break;
|
break;
|
||||||
case '1':
|
case '1':
|
||||||
params.x509 = 0;
|
params.x509 = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user