[CRIU] [PATCH 1/3] sd-daemon.c: whitespace cleanup

Kir Kolyshkin kir at openvz.org
Thu Dec 19 13:24:27 PST 2013


We use tabs for indentation.

Also, s/fd ++/fd++/

Cc: Shawn Landden <shawn at churchofgit.com>
Signed-off-by: Kir Kolyshkin <kir at openvz.org>
---
 sd-daemon.c | 149 ++++++++++++++++++++++++++++++------------------------------
 1 file changed, 74 insertions(+), 75 deletions(-)

diff --git a/sd-daemon.c b/sd-daemon.c
index 653fbf5..3558aaf 100644
--- a/sd-daemon.c
+++ b/sd-daemon.c
@@ -49,84 +49,83 @@
 _sd_export_ int sd_listen_fds(int unset_environment) {
 
 #if defined(DISABLE_SYSTEMD) || !defined(__linux__)
-        return 0;
+	return 0;
 #else
-        int r, fd;
-        const char *e;
-        char *p = NULL;
-        unsigned long l;
-
-        e = getenv("LISTEN_PID");
-        if (!e) {
-                r = 0;
-                goto finish;
-        }
-
-        errno = 0;
-        l = strtoul(e, &p, 10);
-
-        if (errno > 0) {
-                r = -errno;
-                goto finish;
-        }
-
-        if (!p || p == e || *p || l <= 0) {
-                r = -EINVAL;
-                goto finish;
-        }
-
-        /* Is this for us? */
-        if (getpid() != (pid_t) l) {
-                r = 0;
-                goto finish;
-        }
-
-        e = getenv("LISTEN_FDS");
-        if (!e) {
-                r = 0;
-                goto finish;
-        }
-
-        errno = 0;
-        l = strtoul(e, &p, 10);
-
-        if (errno > 0) {
-                r = -errno;
-                goto finish;
-        }
-
-        if (!p || p == e || *p) {
-                r = -EINVAL;
-                goto finish;
-        }
-
-        for (fd = SD_LISTEN_FDS_START; fd < SD_LISTEN_FDS_START + (int) l; fd ++) {
-                int flags;
-
-                flags = fcntl(fd, F_GETFD);
-                if (flags < 0) {
-                        r = -errno;
-                        goto finish;
-                }
-
-                if (flags & FD_CLOEXEC)
-                        continue;
-
-                if (fcntl(fd, F_SETFD, flags | FD_CLOEXEC) < 0) {
-                        r = -errno;
-                        goto finish;
-                }
-        }
-
-        r = (int) l;
+	int r, fd;
+	const char *e;
+	char *p = NULL;
+	unsigned long l;
+
+	e = getenv("LISTEN_PID");
+	if (!e) {
+		r = 0;
+		goto finish;
+	}
+
+	errno = 0;
+	l = strtoul(e, &p, 10);
+
+	if (errno > 0) {
+		r = -errno;
+		goto finish;
+	}
+
+	if (!p || p == e || *p || l <= 0) {
+		r = -EINVAL;
+		goto finish;
+	}
+
+	/* Is this for us? */
+	if (getpid() != (pid_t) l) {
+		r = 0;
+		goto finish;
+	}
+
+	e = getenv("LISTEN_FDS");
+	if (!e) {
+		r = 0;
+		goto finish;
+	}
+
+	errno = 0;
+	l = strtoul(e, &p, 10);
+
+	if (errno > 0) {
+		r = -errno;
+		goto finish;
+	}
+
+	if (!p || p == e || *p) {
+		r = -EINVAL;
+		goto finish;
+	}
+
+	for (fd = SD_LISTEN_FDS_START; fd < SD_LISTEN_FDS_START + (int)l; fd++) {
+		int flags;
+
+		flags = fcntl(fd, F_GETFD);
+		if (flags < 0) {
+			r = -errno;
+			goto finish;
+		}
+
+		if (flags & FD_CLOEXEC)
+			continue;
+
+		if (fcntl(fd, F_SETFD, flags | FD_CLOEXEC) < 0) {
+			r = -errno;
+			goto finish;
+		}
+	}
+
+	r = (int) l;
 
 finish:
-        if (unset_environment) {
-                unsetenv("LISTEN_PID");
-                unsetenv("LISTEN_FDS");
-        }
+	if (unset_environment) {
+		unsetenv("LISTEN_PID");
+		unsetenv("LISTEN_FDS");
+	}
 
-        return r;
+	return r;
 #endif
 }
-
-- 
1.8.1.4



More information about the CRIU mailing list