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>

authored by Josh Poimboeuf and committed by Ingo Molnar 385d11b1 2a0098d7

+3 -1
+3 -1
tools/objtool/elf.c
··· 26 26 #include <stdlib.h> 27 27 #include <string.h> 28 28 #include <unistd.h> 29 + #include <errno.h> 29 30 30 31 #include "elf.h" 31 32 #include "warn.h" ··· 359 358 360 359 elf->fd = open(name, flags); 361 360 if (elf->fd == -1) { 362 - perror("open"); 361 + fprintf(stderr, "objtool: Can't open '%s': %s\n", 362 + name, strerror(errno)); 363 363 goto err; 364 364 } 365 365