From 30804507f983600266e36ff9db632ff7685ca8c0 Mon Sep 17 00:00:00 2001 From: Peter Lieven Date: Sat, 17 Nov 2012 12:40:33 +0100 Subject: [PATCH] SYNC set status to -1 on error in event_loop If there is an error in iscsi_service or on poll we exit the event_loop. But in this case scsi_sync_cb is never reached and the status is 0. This will make the caller think that the sync task has been completed successfully. --- lib/sync.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/sync.c b/lib/sync.c index 4a0cce1..67d545e 100644 --- a/lib/sync.c +++ b/lib/sync.c @@ -47,6 +47,7 @@ event_loop(struct iscsi_context *iscsi, struct iscsi_sync_state *state) if ((ret = poll(&pfd, 1, 1000)) < 0) { iscsi_set_error(iscsi, "Poll failed"); + state->status = -1; return; } if (ret == 0) { @@ -57,6 +58,7 @@ event_loop(struct iscsi_context *iscsi, struct iscsi_sync_state *state) iscsi_set_error(iscsi, "iscsi_service failed with : %s", iscsi_get_error(iscsi)); + state->status = -1; return; } }