Skip to content

Commit 385d11b

Browse files
jpoimboeingomolnar
authored andcommitted
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>
1 parent 2a0098d commit 385d11b

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎tools/objtool/elf.c‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include <stdlib.h>
2727
#include <string.h>
2828
#include <unistd.h>
29+
#include <errno.h>
2930

3031
#include "elf.h"
3132
#include "warn.h"
@@ -358,7 +359,8 @@ struct elf *elf_open(const char *name, int flags)
358359

359360
elf->fd = open(name, flags);
360361
if (elf->fd == -1) {
361-
perror("open");
362+
fprintf(stderr, "objtool: Can't open '%s': %s\n",
363+
name, strerror(errno));
362364
goto err;
363365
}
364366

0 commit comments

Comments
 (0)