]> gitweb.ps.run Git - ps-cgit/blobdiff - shared.c
display subject instead of sha1 as link title of parents
[ps-cgit] / shared.c
index a27ab30716f276e4f6644e11734b19bc7cff1d5c..5f4679335e0f063cadc57b79953f2c078cff11a3 100644 (file)
--- a/shared.c
+++ b/shared.c
@@ -59,6 +59,7 @@ struct cgit_repo *cgit_add_repo(const char *url)
        ret->snapshots = ctx.cfg.snapshots;
        ret->enable_log_filecount = ctx.cfg.enable_log_filecount;
        ret->enable_log_linecount = ctx.cfg.enable_log_linecount;
+       ret->enable_remote_branches = ctx.cfg.enable_remote_branches;
        ret->max_stats = ctx.cfg.max_stats;
        ret->module_link = ctx.cfg.module_link;
        ret->readme = NULL;
@@ -400,15 +401,16 @@ int cgit_close_filter(struct cgit_filter *filter)
  */
 int readfile(const char *path, char **buf, size_t *size)
 {
-       int fd;
+       int fd, e;
        struct stat st;
 
        fd = open(path, O_RDONLY);
        if (fd == -1)
                return errno;
        if (fstat(fd, &st)) {
+               e = errno;
                close(fd);
-               return errno;
+               return e;
        }
        if (!S_ISREG(st.st_mode)) {
                close(fd);
@@ -416,7 +418,8 @@ int readfile(const char *path, char **buf, size_t *size)
        }
        *buf = xmalloc(st.st_size + 1);
        *size = read_in_full(fd, *buf, st.st_size);
+       e = errno;
        (*buf)[*size] = '\0';
        close(fd);
-       return (*size == st.st_size ? 0 : errno);
+       return (*size == st.st_size ? 0 : e);
 }