[PATCHv2,5/6] remote: pull_snapshot_ids: Simplify if condition

Submitted by Radostin Stoyanov on Sept. 3, 2018, 8:35 p.m.

Details

Message ID 20180903203514.32423-6-rstoyanov1@gmail.com
State New
Series "remote: Refactor TCP client/server setup"
Headers show

Commit Message

Radostin Stoyanov Sept. 3, 2018, 8:35 p.m.
Check once if (sockfd < 0)

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

Patch hide | download patch | download mbox

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) {