[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] Honour errors when processing more than one file
Hi,
When using dwz -L0 on a hello world a.out, it fails:
...
$ dwz -L0 a.out
$ echo $?
1
...
But when we do the same for a.out and a copy b.out, it passes:
...
$ cp a.out b.out
$ dwz -L0 a.out b.out
$ echo $?
0
...
Fix this by honouring dwz return codes when processing more than one file.
OK for trunk?
Thanks,
- Tom
Honour errors when processing more than one file
2019-03-04 Tom de Vries <tdevries@suse.de>
PR dwz/24301
* dwz.c (main): Handle dwz returning 1 if processing more than one file.
* testsuite/dwz.tests/two-files-too-many-dies.sh: New test.
---
dwz.c | 2 ++
testsuite/dwz.tests/two-files-too-many-dies.sh | 19 +++++++++++++++++++
2 files changed, 21 insertions(+)
diff --git a/dwz.c b/dwz.c
index d348418..0c53c4b 100644
--- a/dwz.c
+++ b/dwz.c
@@ -11940,6 +11940,8 @@ main (int argc, char *argv[])
}
else if (resa[i - optind].res == 0)
successcount++;
+ if (thisret == 1)
+ return 1;
if (hardlink
&& resa[i - optind].res >= 0
&& resa[i - optind].nlink > 1)
diff --git a/testsuite/dwz.tests/two-files-too-many-dies.sh b/testsuite/dwz.tests/two-files-too-many-dies.sh
new file mode 100755
index 0000000..7214ff6
--- /dev/null
+++ b/testsuite/dwz.tests/two-files-too-many-dies.sh
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+set -e
+
+cp ../hello 1
+cp ../hello 2
+
+if dwz -L0 1 2 2>/dev/null; then
+ exit 1
+fi
+
+cmp 1 ../hello
+cmp 2 ../hello
+
+ls=$(ls)
+ls=$(echo $ls)
+[ "$ls" = "1 2" ]
+
+rm -f 1 2