From d029030308aeb14ffecda20812e1ab56cb5dbec2 Mon Sep 17 00:00:00 2001 From: Harald Freudenberger Date: Tue, 29 Aug 2017 12:54:36 +0200 Subject: [PATCH] chzcrypt: Corrected handling of insufficient permissions. The -d and -e options did not show any failure message when executed with insufficient permissions (e.g. not root user). Now the behaviour is equal to the other options: A message 'chzcrypt: Error - can't write to xxx. Wrong permissions or wrong tools version' is printed. Signed-off-by: Harald Freudenberger Signed-off-by: Michael Holzheu --- zconf/zcrypt/chzcrypt.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/zconf/zcrypt/chzcrypt.c b/zconf/zcrypt/chzcrypt.c index dcfba823..9473ccb7 100644 --- a/zconf/zcrypt/chzcrypt.c +++ b/zconf/zcrypt/chzcrypt.c @@ -406,12 +406,14 @@ int main(int argc, char *argv[]) if (!util_path_is_dir(dev_path)) errx(EXIT_FAILURE, "Error - cryptographic device %s does not exist.", device); if (!util_path_is_writable("%s/online", dev_path)) - continue; + errx(EXIT_FAILURE, "Error - can't write to %s/online.\n Wrong permissions" + " or wrong tools version.", dev_path); verbose("Setting cryptographic device %s %s\n", device, online_text); util_file_write_s(online, "%s/online", dev_path); util_file_read_line(online_read, sizeof(online_read), "%s/online", dev_path); if (strcmp(online, online_read) != 0) - errx(EXIT_FAILURE, "Error - unable to set cryptographic device %s %s.", device, online_text); + errx(EXIT_FAILURE, "Error - unable to set cryptographic device %s %s.", + device, online_text); free(dev_path); } free(dev_list);