]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
cryptsetup: minor coding style clean-ups
authorLennart Poettering <lennart@poettering.net>
Wed, 21 Aug 2019 08:40:04 +0000 (10:40 +0200)
committerLennart Poettering <lennart@poettering.net>
Tue, 19 Nov 2019 14:34:09 +0000 (15:34 +0100)
src/cryptsetup/cryptsetup.c

index dd1504dc9daf7a311ccb7711399b38290333a348..f993a5f66bce37c707c1cf1e0b04d4c30e36fe9f 100644 (file)
@@ -253,10 +253,10 @@ static int parse_options(const char *options) {
         }
 
         /* sanity-check options */
-        if (arg_type != NULL && !streq(arg_type, CRYPT_PLAIN)) {
-                if (arg_offset)
+        if (arg_type && !streq(arg_type, CRYPT_PLAIN)) {
+                if (arg_offset != 0)
                       log_warning("offset= ignored with type %s", arg_type);
-                if (arg_skip)
+                if (arg_skip != 0)
                       log_warning("skip= ignored with type %s", arg_type);
         }
 
@@ -462,11 +462,13 @@ static int attach_tcrypt(
         return 0;
 }
 
-static int attach_luks_or_plain(struct crypt_device *cd,
-                                const char *name,
-                                const char *key_file,
-                                char **passwords,
-                                uint32_t flags) {
+static int attach_luks_or_plain(
+                struct crypt_device *cd,
+                const char *name,
+                const char *key_file,
+                char **passwords,
+                uint32_t flags) {
+
         int r = 0;
         bool pass_volume_key = false;
 
@@ -538,6 +540,7 @@ static int attach_luks_or_plain(struct crypt_device *cd,
                 }
                 if (r < 0)
                         return log_error_errno(r, "Failed to activate with key file '%s': %m", key_file);
+
         } else {
                 char **p;
 
@@ -650,7 +653,7 @@ static int run(int argc, char *argv[]) {
                 }
 
                 /* A delicious drop of snake oil */
-                mlockall(MCL_FUTURE);
+                (void) mlockall(MCL_FUTURE);
 
                 if (arg_header) {
                         log_debug("LUKS header: %s", arg_header);
@@ -723,11 +726,7 @@ static int run(int argc, char *argv[]) {
                         if (streq_ptr(arg_type, CRYPT_TCRYPT))
                                 r = attach_tcrypt(cd, argv[2], key_file, passwords, flags);
                         else
-                                r = attach_luks_or_plain(cd,
-                                                         argv[2],
-                                                         key_file,
-                                                         passwords,
-                                                         flags);
+                                r = attach_luks_or_plain(cd, argv[2], key_file, passwords, flags);
                         if (r >= 0)
                                 break;
                         if (r != -EAGAIN)