aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBart Van Assche <bvanassche@acm.org>2022-04-21 15:18:27 -0700
committerJaegeuk Kim <jaegeuk@kernel.org>2022-04-22 12:42:51 -0700
commit93c6483b85141551e6a5fea339ab4c6cc1f9cc8c (patch)
treeaba58852816ee07ebe2cf58ef53f7116849f1fe0
parent559e60ef1bdcac2084052acd0c1682653c6540d3 (diff)
downloadf2fs-tools-93c6483b85141551e6a5fea339ab4c6cc1f9cc8c.tar.gz
tools/f2fscrypt.c: Fix build without uuid/uuid.h header file
Signed-off-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
-rw-r--r--tools/f2fscrypt.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/tools/f2fscrypt.c b/tools/f2fscrypt.c
index 0f0650f..293173f 100644
--- a/tools/f2fscrypt.c
+++ b/tools/f2fscrypt.c
@@ -45,6 +45,8 @@
#endif
#ifdef HAVE_UUID_UUID_H
#include <uuid/uuid.h>
+#else
+typedef unsigned char uuid_t[16];
#endif
#if !defined(HAVE_ADD_KEY) || !defined(HAVE_KEYCTL)
@@ -354,11 +356,13 @@ static void parse_salt(char *salt_str, int flags)
perror("F2FS_IOC_GET_ENCRYPTION_PWSALT");
exit(1);
}
+#ifdef HAVE_UUID_UUID_H
if (options & OPT_VERBOSE) {
char tmp[80];
uuid_unparse(buf, tmp);
printf("%s has pw salt %s\n", cp, tmp);
}
+#endif
salt_len = 16;
} else if (strncmp(cp, "f:", 2) == 0) {
cp += 2;
@@ -380,8 +384,10 @@ static void parse_salt(char *salt_str, int flags)
(((unsigned char)(h - hexchars) << 4) +
(unsigned char)(l - hexchars));
}
+#ifdef HAVE_UUID_UUID_H
} else if (uuid_parse(cp, buf) == 0) {
salt_len = 16;
+#endif
} else {
invalid_salt:
fprintf(stderr, "Invalid salt: %s\n", salt_str);