summaryrefslogtreecommitdiff
path: root/scan-tree.c
diff options
context:
space:
mode:
Diffstat (limited to 'scan-tree.c')
-rw-r--r--scan-tree.c16
1 files changed, 2 insertions, 14 deletions
diff --git a/scan-tree.c b/scan-tree.c
index 47f3988..95dc65b 100644
--- a/scan-tree.c
+++ b/scan-tree.c
@@ -35,25 +35,13 @@ static int is_git_dir(const char *path)
return 1;
}
-char *readfile(const char *path)
-{
- FILE *f;
- static char buf[MAX_PATH];
-
- if (!(f = fopen(path, "r")))
- return NULL;
- buf[0] = 0;
- fgets(buf, MAX_PATH, f);
- fclose(f);
- return buf;
-}
-
static void add_repo(const char *base, const char *path)
{
struct cgit_repo *repo;
struct stat st;
struct passwd *pwd;
char *p;
+ size_t size;
if (stat(path, &st)) {
fprintf(stderr, "Error accessing %s: %s (%d)\n",
@@ -80,7 +68,7 @@ static void add_repo(const char *base, const char *path)
p = fmt("%s/description", path);
if (!stat(p, &st))
- repo->desc = xstrdup(readfile(p));
+ readfile(p, &repo->desc, &size);
p = fmt("%s/README.html", path);
if (!stat(p, &st))
subject'>Amend changelogRené 'Necoro' Neumann1-0/+1 2023-05-12Issue #95 Add warning when config can be read globally.René 'Necoro' Neumann1-0/+11 2023-05-11Issue #95: Change cache ownership.René 'Necoro' Neumann1-0/+4 There is no need for the cache to be accessible by anyone who is not us. Thus enforce the cache to be stored with 0600. 2023-05-11Issue #95: Add hint about sensible access rights.René 'Necoro' Neumann1-0/+1 2023-04-23[workflow] Port changes also to releaseRené 'Necoro' Neumann1-6/+5 2023-04-23[workflow] Checkout before go setupRené 'Necoro' Neumann1-3/+3 2023-04-23[workflow] determine go version from go.modRené 'Necoro' Neumann1-3/+2 2023-04-23Improve test to also validate error messageRené 'Necoro' Neumann1-42/+39 2023-04-22Fix/improve testsRené 'Necoro' Neumann1-59/+104 2023-04-22Improve error handlingRené 'Necoro' Neumann1-1/+11 2023-04-21Fix workflow: '1.20' needs to be quotedRené 'Necoro' Neumann2-2/+2