From bc85302b02f8a1af351d05050f9de8a54c68ba09 Mon Sep 17 00:00:00 2001 From: Zhihao Cheng Date: Mon, 11 Nov 2024 16:36:34 +0800 Subject: ubifs-utils: Define PROGRAM_NAME as variable PROGRAM_NAME is defined as a const string "mkfs.ubifs", which won't be suitable for fsck.ubifs. Add 'program_name' member in ubifs_info structure, define PROGRAM_NAME as ubifs_info.program_name. Then, error messages will display right program name if fsck.ubifs is supported. Besides, add 'program_type' member in ubifs_info structure to identify which current program type is, without comparing program name. Signed-off-by: Zhihao Cheng Signed-off-by: David Oberhollenzer --- ubifs-utils/common/crypto.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'ubifs-utils/common/crypto.c') diff --git a/ubifs-utils/common/crypto.c b/ubifs-utils/common/crypto.c index 60a67a4..614a16d 100644 --- a/ubifs-utils/common/crypto.c +++ b/ubifs-utils/common/crypto.c @@ -23,10 +23,14 @@ #include #include -#define PROGRAM_NAME "mkfs.ubifs" -#include "common.h" -#include "defs.h" #include "fscrypt.h" +#include "defs.h" +#include "ubifs.h" + +/* common.h requires the PROGRAM_NAME macro */ +extern struct ubifs_info info_; +#define PROGRAM_NAME (info_.program_name) +#include "common.h" static int do_hash(const EVP_MD *md, const unsigned char *in, size_t len, unsigned char *out) { -- cgit v1.2.3