~sircmpwn/gmni-devel

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
1

[PATCH] add a missing "/" to autoindex paths

Details
Message ID
<20201013070510.723276-1-eengeibee2oa@paperboats.net>
DKIM signature
pass
Download raw message
Patch: +1 -2
With the following directory structure:

/srv/gmni:
baz/  foo/

/srv/gmni/baz:
a

/srv/gmni/foo:
bar/

/srv/gmni/foo/bar:
b

trying to access gemini://somesite/ with autoindex=on works,
but accessing /foo fails because it tries to stat /srv/gmni/foobar
instead of /srv/gmni/foo/bar. This commit fixes that by adding a trailing slash.
---
 src/serve.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/serve.c b/src/serve.c
index a856bc2..740b378 100644
--- a/src/serve.c
+++ b/src/serve.c
@@ -56,8 +56,7 @@ serve_autoindex(struct gmnisrv_client *client, const char *path)
	errno = 0;
	while ((ent = readdir(dirp)) != NULL) {
		char fpath[PATH_MAX + 1];
		strcpy(fpath, path);
		strncat(fpath, ent->d_name, sizeof(fpath));
		snprintf(fpath, PATH_MAX + 1, "%s/%s", path, ent->d_name);

		struct stat st;
		if (stat(fpath, &st) != 0) {
-- 
2.28.0
Details
Message ID
<C6DQ0TFB6WD7.19KLIFHUZM40T@taiga>
In-Reply-To
<20201013070510.723276-1-eengeibee2oa@paperboats.net> (view parent)
DKIM signature
fail
Download raw message
DKIM signature: fail
Thanks!

To git@git.sr.ht:~sircmpwn/gmnisrv
   a22bec5..e77f354  master -> master
Review patch Export thread (mbox)