From: Sascha Hauer <s.hauer@pengutronix.de>
To: BAREBOX <barebox@lists.infradead.org>
Subject: [PATCH 4/4] rkimage: improve error handling
Date: Wed, 29 Apr 2026 12:19:56 +0200 [thread overview]
Message-ID: <20260429-rkimage-resign-v1-4-1478086c369e@pengutronix.de> (raw)
In-Reply-To: <20260429-rkimage-resign-v1-0-1478086c369e@pengutronix.de>
Complain when outfile is not given. Also, mention that we actually can't
create a file which is more accurate than just saying "open". While at
it fix some tab/whitespace issues.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
scripts/rkimage.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/scripts/rkimage.c b/scripts/rkimage.c
index 2dc67f499b..8243742d65 100644
--- a/scripts/rkimage.c
+++ b/scripts/rkimage.c
@@ -389,8 +389,8 @@ static int sign_newidb(struct newidb *idb, const char *path)
#else
static int sign_newidb(struct newidb *idb, const char *path)
{
- fprintf(stderr, "Signing support requires at least OpenSSL 3.0\n");
- return -ENOSYS;
+ fprintf(stderr, "Signing support requires at least OpenSSL 3.0\n");
+ return -ENOSYS;
}
#endif
@@ -481,6 +481,12 @@ int main(int argc, char *argv[])
n_code = argc - optind;
+ if (!outfile) {
+ fprintf(stderr, "No output file specified, use -o\n");
+ usage(argv[0]);
+ exit(1);
+ }
+
if (re_sign) {
if (n_code) {
fprintf(stderr, "unhandled non-opt arguments\n");
@@ -543,7 +549,7 @@ int main(int argc, char *argv[])
fd = creat(outfile, 0644);
if (fd < 0) {
- fprintf(stderr, "Cannot open %s: %s\n", outfile, strerror(errno));
+ fprintf(stderr, "Cannot create %s: %s\n", outfile, strerror(errno));
exit(1);
}
--
2.47.3
next prev parent reply other threads:[~2026-04-29 10:20 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-29 10:19 [PATCH 0/4] rkimage: Add resigning support Sascha Hauer
2026-04-29 10:19 ` [PATCH 1/4] rkimage: Support openssl provider API Sascha Hauer
2026-04-29 10:19 ` [PATCH 2/4] rkimage: unconditionally fill newidb Sascha Hauer
2026-04-29 10:19 ` [PATCH 3/4] rkimage: add support for re-signing an existing image Sascha Hauer
2026-04-29 10:19 ` Sascha Hauer [this message]
2026-05-07 10:39 ` [PATCH 0/4] rkimage: Add resigning support Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260429-rkimage-resign-v1-4-1478086c369e@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox