diff options
author | Rafael G. Martins <rafael@rafaelmartins.eng.br> | 2016-11-17 23:34:27 +0100 |
---|---|---|
committer | Rafael G. Martins <rafael@rafaelmartins.eng.br> | 2016-11-17 23:34:27 +0100 |
commit | 0db557041908b483ec77439bb5e1db982464d327 (patch) | |
tree | 9aa25afb81bc6a9545723aa93e839767ef0989b9 /src/blogc-git-receiver/pre-receive.c | |
parent | fc52952914747dc937c805baa211a251a795b847 (diff) | |
download | blogc-0db557041908b483ec77439bb5e1db982464d327.tar.gz blogc-0db557041908b483ec77439bb5e1db982464d327.tar.bz2 blogc-0db557041908b483ec77439bb5e1db982464d327.zip |
git-receiver: when rebuilding, change to repo dir asap
Diffstat (limited to 'src/blogc-git-receiver/pre-receive.c')
-rw-r--r-- | src/blogc-git-receiver/pre-receive.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/blogc-git-receiver/pre-receive.c b/src/blogc-git-receiver/pre-receive.c index 99e15dd..954c379 100644 --- a/src/blogc-git-receiver/pre-receive.c +++ b/src/blogc-git-receiver/pre-receive.c @@ -104,6 +104,11 @@ bgr_pre_receive_hook(int argc, char *argv[]) return 1; } char *repo_dir = dirname(real_hooks_dir); + if (0 != chdir(repo_dir)) { + fprintf(stderr, "error: failed to change to repository root\n"); + free(real_hooks_dir); + return 1; + } char *htdocs_sym = bc_strdup_printf("%s/htdocs", repo_dir); free(real_hooks_dir); if (0 != access(htdocs_sym, F_OK)) { |