git.annexia.org
/
hivex.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
d5e1a21
)
hivexsh: cd command: fix error handling
author
Richard Jones
<rjones@redhat.com>
Thu, 4 Feb 2010 16:31:09 +0000
(16:31 +0000)
committer
Richard Jones
<rjones@redhat.com>
Fri, 19 Feb 2010 15:01:34 +0000
(15:01 +0000)
The error behaviour of hivex_node_get_child is subtle, so the 'cd'
command wouldn't always report errors correctly. This fixes it.
hivex/hivexsh.c
patch
|
blob
|
history
diff --git
a/hivex/hivexsh.c
b/hivex/hivexsh.c
index
ceb1153
..
39ca634
100644
(file)
--- a/
hivex/hivexsh.c
+++ b/
hivex/hivexsh.c
@@
-559,10
+559,14
@@
cmd_cd (char *path)
continue;
}
+ errno = 0;
new_cwd = hivex_node_get_child (h, new_cwd, elem);
if (new_cwd == 0) {
- fprintf (stderr, _("hivexsh: cd: subkey '%s' not found\n"),
- elem);
+ if (errno)
+ perror ("hivexsh: cd");
+ else
+ fprintf (stderr, _("hivexsh: cd: subkey '%s' not found\n"),
+ elem);
return -1;
}
}