[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tip-385d11b152c4eb638eeb769edcb3249533bb9a00@git.kernel.org>
Date: Mon, 15 Jan 2018 19:37:50 -0800
From: tip-bot for Josh Poimboeuf <tipbot@...or.com>
To: linux-tip-commits@...r.kernel.org
Cc: peterz@...radead.org, hpa@...or.com, jpoimboe@...hat.com,
torvalds@...ux-foundation.org, mingo@...nel.org, M4rkusXXL@....de,
linux-kernel@...r.kernel.org, tglx@...utronix.de
Subject: [tip:x86/pti] objtool: Improve error message for bad file argument
Commit-ID: 385d11b152c4eb638eeb769edcb3249533bb9a00
Gitweb: https://git.kernel.org/tip/385d11b152c4eb638eeb769edcb3249533bb9a00
Author: Josh Poimboeuf <jpoimboe@...hat.com>
AuthorDate: Mon, 15 Jan 2018 08:17:08 -0600
Committer: Ingo Molnar <mingo@...nel.org>
CommitDate: Tue, 16 Jan 2018 01:27:27 +0100
objtool: Improve error message for bad file argument
If a nonexistent file is supplied to objtool, it complains with a
non-helpful error:
open: No such file or directory
Improve it to:
objtool: Can't open 'foo': No such file or directory
Reported-by: Markus <M4rkusXXL@....de>
Signed-off-by: Josh Poimboeuf <jpoimboe@...hat.com>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Thomas Gleixner <tglx@...utronix.de>
Link: http://lkml.kernel.org/r/406a3d00a21225eee2819844048e17f68523ccf6.1516025651.git.jpoimboe@redhat.com
Signed-off-by: Ingo Molnar <mingo@...nel.org>
---
tools/objtool/elf.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/tools/objtool/elf.c b/tools/objtool/elf.c
index 2446015..c1c3386 100644
--- a/tools/objtool/elf.c
+++ b/tools/objtool/elf.c
@@ -26,6 +26,7 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <errno.h>
#include "elf.h"
#include "warn.h"
@@ -358,7 +359,8 @@ struct elf *elf_open(const char *name, int flags)
elf->fd = open(name, flags);
if (elf->fd == -1) {
- perror("open");
+ fprintf(stderr, "objtool: Can't open '%s': %s\n",
+ name, strerror(errno));
goto err;
}
Powered by blists - more mailing lists