aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMattias Andrée <maandree@member.fsf.org>2015-12-28 14:00:42 +0100
committerMattias Andrée <maandree@member.fsf.org>2015-12-28 14:00:42 +0100
commit4fc510f4cbf54686eb2e95df9f4ff4f41e8ce05c (patch)
treee1c15a97a2a2983671b925b373dfb17f27c932cb /src
parentdoc (diff)
downloadsat-4fc510f4cbf54686eb2e95df9f4ff4f41e8ce05c.tar.gz
sat-4fc510f4cbf54686eb2e95df9f4ff4f41e8ce05c.tar.bz2
sat-4fc510f4cbf54686eb2e95df9f4ff4f41e8ce05c.tar.xz
reorder actions
Signed-off-by: Mattias Andrée <maandree@member.fsf.org>
Diffstat (limited to '')
-rw-r--r--src/satd.c30
1 files changed, 15 insertions, 15 deletions
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));