From 4fc510f4cbf54686eb2e95df9f4ff4f41e8ce05c Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Mon, 28 Dec 2015 14:00:42 +0100 Subject: reorder actions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/satd.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/satd.c b/src/satd.c index 2d370e8..ed5d07a 100644 --- a/src/satd.c +++ b/src/satd.c @@ -175,6 +175,21 @@ main(int argc, char *argv[]) if (!(foreground = !strcmp(argv[1], "-f"))) usage(); + /* Get hook-script pathname. */ + if (!getenv("SAT_HOOK_PATH")) { + int do_not_free = 0; + path = hookpath("XDG_CONFIG_HOME", "/sat/hook"); + t (!path && errno); + path = path ? path : hookpath("HOME", "/.config/sat/hook"); + t (!path && errno); + path = path ? path : hookpath(NULL, "/.config/sat/hook"); + t (!path && errno); + path = path ? path : (do_not_free = 1, "/etc/sat/hook"); + t (setenv("SAT_HOOK_PATH", path, 1)); + if (!do_not_free) + free(path); + } + /* Determinate whether the socket was passed with stdin. */ if (fstat(STDIN_FILENO, &attr)) t (errno != EBADF); @@ -210,21 +225,6 @@ main(int argc, char *argv[]) } } - /* Get hook-script pathname. */ - if (!getenv("SAT_HOOK_PATH")) { - int do_not_free = 0; - path = hookpath("XDG_CONFIG_HOME", "/sat/hook"); - t (!path && errno); - path = path ? path : hookpath("HOME", "/.config/sat/hook"); - t (!path && errno); - path = path ? path : hookpath(NULL, "/.config/sat/hook"); - t (!path && errno); - path = path ? path : (do_not_free = 1, "/etc/sat/hook"); - t (setenv("SAT_HOOK_PATH", path, 1)); - if (!do_not_free) - free(path); - } - /* Listen for incoming conections. */ #if SOMAXCONN < SATD_BACKLOG t (listen(sock, SOMAXCONN)); -- cgit v1.2.3-70-g09d2