batctl: Exit code is now EXIT_FAILURE when throughputmeter fails

Message ID 20200408214903.23134-1-me@irrelefant.net (mailing list archive)
State Accepted, archived
Delegated to: Simon Wunderlich
Headers
Series batctl: Exit code is now EXIT_FAILURE when throughputmeter fails |

Commit Message

Leonardo Mörlein April 8, 2020, 9:49 p.m. UTC
  Before this commit, this command completed indicating success:

[lemoer@orange batctl]$ (sudo batctl tp 77:77:77:77:77:77 && echo true) || echo false
Destination unreachable
true

After this commit, this command expectedly indicates failure:

[lemoer@orange batctl]$ (sudo ./batctl tp 77:77:77:77:77:77 && echo true) || echo false
Destination unreachable
false

Signed-off-by: Leonardo Mörlein <me@irrelefant.net>
---
 throughputmeter.c | 1 +
 1 file changed, 1 insertion(+)
  

Patch

diff --git a/throughputmeter.c b/throughputmeter.c
index 27f1346..0ec5c31 100644
--- a/throughputmeter.c
+++ b/throughputmeter.c
@@ -465,6 +465,7 @@  static int throughputmeter(struct state *state, int argc, char **argv)
 		goto out;
 	}
 
+	ret = EXIT_FAILURE;
 	switch (result.return_value) {
 	case BATADV_TP_REASON_DST_UNREACHABLE:
 		fprintf(stderr, "Destination unreachable\n");