[CRIU] [PATCH 1/3] sd-daemon.c: whitespace cleanup
shawn at churchofgit.com
shawn at churchofgit.com
Thu Dec 19 14:34:03 PST 2013
---- Original Message ----
From: "Kir Kolyshkin"
To: criu at openvz.org
CC: xemul at parallels.com, "Kir Kolyshkin" , "Shawn Landden"
Sent: Thu, Dec 19, 2013, 01:24 PM
Subject: [PATCH 1/3] sd-daemon.c: whitespace cleanup
We use tabs for indentation.
Also, s/fd ++/fd++/
I didn't write this code, it is imported from systemd, and IMHO we should keep the style the way it was in the original.
Cc: Shawn Landden
Signed-off-by: Kir Kolyshkin
---
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 = -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 = -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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openvz.org/pipermail/criu/attachments/20131219/dee21152/attachment.html>
More information about the CRIU
mailing list