diff options
Diffstat (limited to 'src/satd.c')
-rw-r--r-- | src/satd.c | 30 |
1 files changed, 15 insertions, 15 deletions
@@ -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)); |