public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Josh Poimboeuf <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: peterz@infradead.org, hpa@zytor.com, jpoimboe@redhat.com,
	torvalds@linux-foundation.org, mingo@kernel.org,
	M4rkusXXL@web.de, linux-kernel@vger.kernel.org,
	tglx@linutronix.de
Subject: [tip:x86/pti] objtool: Improve error message for bad file argument
Date: Mon, 15 Jan 2018 19:37:50 -0800	[thread overview]
Message-ID: <tip-385d11b152c4eb638eeb769edcb3249533bb9a00@git.kernel.org> (raw)
In-Reply-To: <406a3d00a21225eee2819844048e17f68523ccf6.1516025651.git.jpoimboe@redhat.com>

Commit-ID:  385d11b152c4eb638eeb769edcb3249533bb9a00
Gitweb:     https://git.kernel.org/tip/385d11b152c4eb638eeb769edcb3249533bb9a00
Author:     Josh Poimboeuf <jpoimboe@redhat.com>
AuthorDate: Mon, 15 Jan 2018 08:17:08 -0600
Committer:  Ingo Molnar <mingo@kernel.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@web.de>
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/406a3d00a21225eee2819844048e17f68523ccf6.1516025651.git.jpoimboe@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.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;
 	}
 

  reply	other threads:[~2018-01-16  3:42 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-15 14:17 [PATCH 1/2] objtool: Fix seg fault with gold linker Josh Poimboeuf
2018-01-15 14:17 ` [PATCH 2/2] objtool: Improve error message for bad file argument Josh Poimboeuf
2018-01-16  3:37   ` tip-bot for Josh Poimboeuf [this message]
2018-01-16  0:21 ` [PATCH 1/2] objtool: Fix seg fault with gold linker Ingo Molnar
2018-01-16  4:20   ` Josh Poimboeuf
2018-01-16  8:30     ` Ingo Molnar
2018-01-16  3:37 ` [tip:x86/pti] " tip-bot for Josh Poimboeuf

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=tip-385d11b152c4eb638eeb769edcb3249533bb9a00@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=M4rkusXXL@web.de \
    --cc=hpa@zytor.com \
    --cc=jpoimboe@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.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