aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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));