From: Pali Rohár <pali@kernel.org>
Date: Sat, 21 Jan 2023 19:09:26 +0000 (+0100)
Subject: tools: mkimage: Do not try to open datafile when it is skipped
X-Git-Tag: v2025.01-rc5-pxa1908~1023^2~41^2~11
X-Git-Url: http://git.dujemihanovic.xyz/html/static/%7B%7B%20%28.OutputFormats.Get?a=commitdiff_plain;h=b07965b8a9a9887a37f41254d6155f8fc38ad006;p=u-boot.git

tools: mkimage: Do not try to open datafile when it is skipped

When mkimage was instructed to skip datafile via option -s then do not try
to validate or open datafile as it does not have to exist or to be
specified via -d option.

This change allows to use -s option for skipping datafile when -d option
for datafile was not specified.

Signed-off-by: Pali Rohár <pali@kernel.org>
---

diff --git a/tools/mkimage.c b/tools/mkimage.c
index 5e0bb91cea..a92d9d5ca5 100644
--- a/tools/mkimage.c
+++ b/tools/mkimage.c
@@ -599,7 +599,7 @@ int main(int argc, char **argv)
 		exit (retval);
 	}
 
-	if ((params.type != IH_TYPE_MULTI) && (params.type != IH_TYPE_SCRIPT)) {
+	if (!params.skipcpy && params.type != IH_TYPE_MULTI && params.type != IH_TYPE_SCRIPT) {
 		if (!params.datafile) {
 			fprintf(stderr, "%s: Option -d with image data file was not specified\n",
 				params.cmdname);