diff options
author | Rafael G. Martins <rafael@rafaelmartins.eng.br> | 2018-05-30 23:53:26 +0200 |
---|---|---|
committer | Rafael G. Martins <rafael@rafaelmartins.eng.br> | 2018-05-30 23:53:26 +0200 |
commit | 316bd60579ea11daca4fa25e2720b7fa147cc7ba (patch) | |
tree | aa53a0daefe10e4d4f58f04af483db5094611a65 /src/blogc-git-receiver/pre-receive.c | |
parent | 9acec235a6c47c3bede917187808a8acd1369050 (diff) | |
download | blogc-316bd60579ea11daca4fa25e2720b7fa147cc7ba.tar.gz blogc-316bd60579ea11daca4fa25e2720b7fa147cc7ba.tar.bz2 blogc-316bd60579ea11daca4fa25e2720b7fa147cc7ba.zip |
git-receiver: centralize settings to reuse later
Diffstat (limited to 'src/blogc-git-receiver/pre-receive.c')
-rw-r--r-- | src/blogc-git-receiver/pre-receive.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/blogc-git-receiver/pre-receive.c b/src/blogc-git-receiver/pre-receive.c index 20c6738..3668f8b 100644 --- a/src/blogc-git-receiver/pre-receive.c +++ b/src/blogc-git-receiver/pre-receive.c @@ -18,6 +18,7 @@ #include "../common/compat.h" #include "../common/utils.h" #include "../common/stdin.h" +#include "settings.h" #include "pre-receive-parser.h" #include "pre-receive.h" @@ -177,18 +178,15 @@ bgr_pre_receive_hook(int argc, char *argv[]) goto cleanup; } - char *home = getenv("BLOGC_GIT_RECEIVER_BASEDIR"); - if (home == NULL) { - home = getenv("HOME"); - } - if (home == NULL) { - fprintf(stderr, "error: failed to find user home path\n"); + const char *bd = bgr_settings_get_basedir(); + if (bd == NULL) { + fprintf(stderr, "error: failed to find user base directory path\n"); rv = 3; goto cleanup; } unsigned long epoch = time(NULL); - output_dir = bc_strdup_printf("%s/builds/%s-%lu", home, master, epoch); + output_dir = bc_strdup_printf("%s/builds/%s-%lu", bd, master, epoch); if (0 == access(output_dir, F_OK)) { char *tmp = output_dir; |