aboutsummaryrefslogtreecommitdiffstats
path: root/src/blogc-git-receiver
diff options
context:
space:
mode:
authorRafael G. Martins <rafael@rafaelmartins.eng.br>2018-12-17 21:55:46 +0100
committerRafael G. Martins <rafael@rafaelmartins.eng.br>2018-12-17 21:55:46 +0100
commit91737269d67a0403727faaa70521ff904dba695b (patch)
treeb5c431f12f0a04c1b7a8a00a27a3e745f9815808 /src/blogc-git-receiver
parent3f58386ebd99fe980b35487ceb721fedcce73ac5 (diff)
downloadblogc-91737269d67a0403727faaa70521ff904dba695b.tar.gz
blogc-91737269d67a0403727faaa70521ff904dba695b.tar.bz2
blogc-91737269d67a0403727faaa70521ff904dba695b.zip
git-receiver: make: runserver: improved realpath(3) usage
Diffstat (limited to 'src/blogc-git-receiver')
-rw-r--r--src/blogc-git-receiver/post-receive.c5
-rw-r--r--src/blogc-git-receiver/pre-receive.c5
2 files changed, 7 insertions, 3 deletions
diff --git a/src/blogc-git-receiver/post-receive.c b/src/blogc-git-receiver/post-receive.c
index 3b0f48c..3c7cb00 100644
--- a/src/blogc-git-receiver/post-receive.c
+++ b/src/blogc-git-receiver/post-receive.c
@@ -6,6 +6,8 @@
* See the file LICENSE.
*/
+#include <errno.h>
+#include <string.h>
#include <stdio.h>
#include <libgen.h>
#include <unistd.h>
@@ -25,7 +27,8 @@ bgr_post_receive_hook(int argc, char *argv[])
char *hooks_dir = dirname(argv[0]); // this was validated by main()
char *real_hooks_dir = realpath(hooks_dir, NULL);
if (real_hooks_dir == NULL) {
- fprintf(stderr, "error: failed to guess repository root.\n");
+ fprintf(stderr, "error: failed to guess repository root: %s\n",
+ strerror(errno));
return 3;
}
diff --git a/src/blogc-git-receiver/pre-receive.c b/src/blogc-git-receiver/pre-receive.c
index ab95fd4..12be165 100644
--- a/src/blogc-git-receiver/pre-receive.c
+++ b/src/blogc-git-receiver/pre-receive.c
@@ -101,7 +101,8 @@ bgr_pre_receive_hook(int argc, char *argv[])
char *hooks_dir = dirname(argv[0]); // this was validated by main()
char *real_hooks_dir = realpath(hooks_dir, NULL);
if (real_hooks_dir == NULL) {
- fprintf(stderr, "error: failed to guess repository root.\n");
+ fprintf(stderr, "error: failed to guess repository root: %s\n",
+ strerror(errno));
return 3;
}
@@ -152,7 +153,7 @@ default_sym:
char *build_dir = realpath(sym, NULL);
if (build_dir == NULL) {
fprintf(stderr, "error: failed to get the hash of last built "
- "commit.\n");
+ "commit: %s\n", strerror(errno));
rv = 3;
goto cleanup;
}