diff options
author | Jon Turney <jon.turney@dronecode.org.uk> | 2017-04-04 18:47:44 +0100 |
---|---|---|
committer | Jon Turney <jon.turney@dronecode.org.uk> | 2017-04-04 18:47:44 +0100 |
commit | a9da3e4e67bdee6da15771b8f859d381bec01d28 (patch) | |
tree | 62b447631e01bc6b36e224e786698d372ab895da | |
parent | 961a6909d950a0423d0e70e8a64187fb7d535c7d (diff) | |
download | cygnal-a9da3e4e67bdee6da15771b8f859d381bec01d28.tar.gz cygnal-a9da3e4e67bdee6da15771b8f859d381bec01d28.tar.bz2 cygnal-a9da3e4e67bdee6da15771b8f859d381bec01d28.zip |
Make ldd stop after any non-continuable exception
Ensure that ldd always stops when the exception is flagged as
non-continuable.
Also arrange for ldd to exit with a non-zero exit code if something went
wrong which prevented us from listing all dynamic dependencies.
Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
-rw-r--r-- | winsup/utils/ldd.cc | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/winsup/utils/ldd.cc b/winsup/utils/ldd.cc index 8e891d872..bbc62f12f 100644 --- a/winsup/utils/ldd.cc +++ b/winsup/utils/ldd.cc @@ -302,6 +302,9 @@ report (const char *in_fn, bool multiple) dlls dll_list = {}; dlls *dll_last = &dll_list; const wchar_t *process_fn = NULL; + + int res = 0; + while (1) { bool exitnow = false; @@ -356,6 +359,11 @@ report (const char *in_fn, bool multiple) TerminateProcess (hProcess, 0); break; } + if (ev.u.Exception.ExceptionRecord.ExceptionFlags & + EXCEPTION_NONCONTINUABLE) { + res = 1; + goto print_and_exit; + } break; case EXIT_PROCESS_DEBUG_EVENT: print_and_exit: @@ -374,7 +382,7 @@ print_and_exit: break; } - return 0; + return res; } int |