mirror of
https://github.com/dgibson/dtc.git
synced 2025-10-13 16:27:39 -04:00
dtc: Make dtc_open_file() die() if unable to open requested file
All current callers of dtc_open_file() immediately die() if it returns an error. In a non-interative tool like dtc, it's hard to see what you could sensibly do to recover from a failure to open an input file in any case. Therefore, make dtc_open_file() itself die() if there's an error opening the requested file. This removes the need for error checking at the callsites, and ensures a consistent error message in all cases. While we're at it, change the rror message from fstree.c when we fail to open the input directory to match dtc_open_file()'s error message. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
parent
6c2e4d61f8
commit
f7ea3708c3
4 changed files with 6 additions and 16 deletions
4
fstree.c
4
fstree.c
|
@ -31,8 +31,8 @@ static struct node *read_fstree(const char *dirname)
|
|||
struct node *tree;
|
||||
|
||||
d = opendir(dirname);
|
||||
if (! d)
|
||||
die("opendir(): %s\n", strerror(errno));
|
||||
if (!d)
|
||||
die("Couldn't opendir() \"%s\": %s\n", dirname, strerror(errno));
|
||||
|
||||
tree = build_node(NULL, NULL);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue