ctdb-common: Switch to ETIMEDOUT from ETIME
authorAmitay Isaacs <amitay@gmail.com>
Tue, 10 Jul 2018 08:19:09 +0000 (18:19 +1000)
committerMartin Schwenke <martins@samba.org>
Sat, 28 Jul 2018 01:50:10 +0000 (03:50 +0200)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13520

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
ctdb/common/run_event.c
ctdb/common/run_proc.c
ctdb/tests/cunit/run_event_001.sh
ctdb/tests/cunit/run_proc_001.sh

index 20e5be84dd2d9f2d52dcf00a9ebb7305f159ba3e..a2155500f289fc32279e3f7ee8fa708d2a99bc40 100644 (file)
@@ -844,11 +844,11 @@ static void run_event_next_script(struct tevent_req *subreq)
                if (! state->continue_on_failure) {
                        state->script_list->num_scripts = state->index + 1;
 
-                       if (script->summary == -ETIME && pid != -1) {
+                       if (script->summary == -ETIMEDOUT && pid != -1) {
                                run_event_debug(req, pid);
                        }
                        D_NOTICE("%s event %s\n", state->event_str,
-                                (script->summary == -ETIME) ?
+                                (script->summary == -ETIMEDOUT) ?
                                  "timed out" :
                                  "failed");
                        run_event_stop_running(state->run_ctx);
index ee83d86da23a74458c02f07093967137f5435f9e..97895b383b9485aa5358df88c14dfaed51f9827c 100644 (file)
@@ -452,7 +452,7 @@ static void run_proc_timedout(struct tevent_req *subreq)
                return;
        }
 
-       state->result.err = ETIME;
+       state->result.err = ETIMEDOUT;
        if (state->proc->output != NULL) {
                state->output = talloc_steal(state, state->proc->output);
        }
index 6735fcbf33e653a4ff31ca35383a10322fb3473d..75c51111b14f5003457efdb9a15877a6d4026454 100755 (executable)
@@ -106,7 +106,7 @@ ok <<EOF
 11.foo: hello
 Event monitor completed with result=0
 11.foo result=0
-22.bar result=-8
+22.bar result=-$(errcode ENOEXEC)
 EOF
 unit_test run_event_test "$scriptdir" run 10 monitor
 
@@ -124,9 +124,9 @@ unit_test run_event_test "$scriptdir" enable 22.bar
 
 ok <<EOF
 11.foo: hello
-Event monitor completed with result=-62
+Event monitor completed with result=-$(errcode ETIMEDOUT)
 11.foo result=0
-22.bar result=-62
+22.bar result=-$(errcode ETIMEDOUT)
 EOF
 unit_test run_event_test "$scriptdir" run 5 monitor
 
index e2fde88612e78f83e735cdec00a4e07c71ec657c..c6aee3721fae95f17159dd1e3dbd8dd1c290f49d 100755 (executable)
@@ -4,7 +4,7 @@
 
 # Invalid path
 ok <<EOF
-Process exited with error 2
+Process exited with error $(errcode ENOENT)
 EOF
 unit_test run_proc_test 0 -1 /a/b/c
 
@@ -15,7 +15,7 @@ echo hello
 EOF
 
 ok <<EOF
-Process exited with error 13
+Process exited with error $(errcode EACCES)
 EOF
 unit_test run_proc_test 0 -1 "$prog"
 
@@ -23,7 +23,7 @@ unit_test run_proc_test 0 -1 "$prog"
 chmod +x "$prog"
 
 ok <<EOF
-Process exited with error 8
+Process exited with error $(errcode ENOEXEC)
 EOF
 unit_test run_proc_test 0 -1 "$prog"
 
@@ -102,7 +102,7 @@ result_filter ()
 }
 
 ok <<EOF
-Process exited with error 62
+Process exited with error $(errcode ETIMEDOUT)
 Child = PID
 Output = (Sleeping for 5 seconds
 )
@@ -119,7 +119,7 @@ sleep 10
 EOF
 
 ok <<EOF
-Process exited with error 62
+Process exited with error $(errcode ETIMEDOUT)
 Child = PID
 EOF
 unit_test run_proc_test 1 -1 "$prog"