[systemd-devel] [PATCH 1/5] test: correctly set the 'ret' variable

Djalal Harouni tixxdz at opendz.org
Wed Jul 23 09:34:32 PDT 2014


Signed-off-by: Djalal Harouni <tixxdz at opendz.org>
---
 test/test-kdbus-policy.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/test/test-kdbus-policy.c b/test/test-kdbus-policy.c
index 6099087..de725e9 100644
--- a/test/test-kdbus-policy.c
+++ b/test/test-kdbus-policy.c
@@ -200,7 +200,7 @@ static int kdbus_normal_test(const char *bus, const char *name,
 static int kdbus_fork_test(const char *bus, const char *name,
 			   struct conn **conn_db)
 {
-	int ret;
+	int ret = 0;
 	int status;
 	pid_t pid;
 	int test_done = 0;
@@ -241,6 +241,7 @@ child_fail:
 
 	ret = waitpid(pid, &status, 0);
 	if (ret < 0) {
+		ret = -errno;
 		fprintf(stderr, "error waitpid: %d (%m)\n", ret);
 		goto out;
 	}
-- 
1.9.3



More information about the systemd-devel mailing list