[CRIU] [PATCHv3 6/8] remote: pull_snapshot_ids: Simplify if condition

Radostin Stoyanov rstoyanov1 at gmail.com
Wed Sep 5 00:26:55 MSK 2018


Check once if (sockfd < 0)

Signed-off-by: Radostin Stoyanov <rstoyanov1 at gmail.com>
---
 criu/img-remote.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/criu/img-remote.c b/criu/img-remote.c
index 9c032a3e..53a30b40 100644
--- a/criu/img-remote.c
+++ b/criu/img-remote.c
@@ -1107,11 +1107,12 @@ static int pull_snapshot_ids(void)
 	sockfd = read_remote_image_connection(NULL_SNAPSHOT_ID, PARENT_IMG);
 
 	/* The connection was successful but there is not file. */
-	if (sockfd < 0 && errno == ENOENT)
+	if (sockfd < 0) {
+		if (errno != ENOENT) {
+			pr_err("Unable to open snapshot id read connection\n");
+			return -1;
+		}
 		return 0;
-	else if (sockfd < 0) {
-		pr_err("Unable to open snapshot id read connection\n");
-		return -1;
 	}
 
 	while (1) {
-- 
2.17.1



More information about the CRIU mailing list