Introduction
Introduction Statistics Contact Development Disclaimer Help
Readd arguments after realpath after latest printelem() changes. - geomyidae - …
git clone git://bitreich.org/geomyidae/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfri…
Log
Files
Refs
Tags
README
LICENSE
---
commit 3401df4e6802a68dd34581ae0de6b7e34f45ea12
parent 6f22091df20685c8b7a8a89823aa31606bea2be0
Author: Christoph Lohmann <[email protected]>
Date: Mon, 5 Apr 2021 22:05:11 +0200
Readd arguments after realpath after latest printelem() changes.
Diffstat:
M ind.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
---
diff --git a/ind.c b/ind.c
@@ -403,7 +403,7 @@ scanfile(char *fname)
int
printelem(int fd, Elems *el, char *file, char *base, char *addr, char *port)
{
- char *path, *p, *argbase, buf[PATH_MAX+1];
+ char *path, *p, *argbase, buf[PATH_MAX+1], *argp;
int len, blen;
if (!strcmp(el->e[3], "server")) {
@@ -439,6 +439,7 @@ printelem(int fd, Elems *el, char *file, char *base, char *…
else
len = strlen(path);
+ /* Strip off arguments for realpath. */
argbase = strchr(el->e[2], '?');
if (argbase != NULL)
blen = argbase - el->e[2];
@@ -451,8 +452,18 @@ printelem(int fd, Elems *el, char *file, char *base, char …
if ((path = realpath(buf, NULL)) &&
!strncmp(base, path, strlen(base))) {
p = path + strlen(base);
+
+ /*
+ * Do not forget to readd arguments which were
+ * stripped off.
+ */
+ if (argbase != NULL)
+ argp = smprintf("%s%s", p[0]? p : "/", argbase…
+ else
+ argp = xstrdup(p[0]? p : "/");
+
free(el->e[2]);
- el->e[2] = xstrdup(p[0]? p : "/");
+ el->e[2] = argp;
}
free(path);
}
You are viewing proxied material from bitreich.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.