Introduction
Introduction Statistics Contact Development Disclaimer Help
handlr.c: use basename() to get the base filename - geomyidae - a small C-based…
git clone git://git.codemadness.org/geomyidae
Log
Files
Refs
README
LICENSE
---
commit 31cab7f26e390b9e29a3f9fa185df6bd67abd826
parent e418a673b849daeac362148c6dfcb3dc9355f4dc
Author: Hiltjo Posthuma <[email protected]>
Date: Sat, 22 Jul 2023 19:15:03 +0200
handlr.c: use basename() to get the base filename
Signed-off-by: Christoph Lohmann <[email protected]>
Diffstat:
M handlr.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/handlr.c b/handlr.c
@@ -144,7 +144,7 @@ handlecgi(int sock, char *file, char *port, char *base, cha…
char *sear, char *ohost, char *chost, char *bhost, int istls,
char *sel, char *traverse)
{
- char *script, *path, *filec;
+ char *script, *path, *filec, *scriptc;
USED(base);
USED(port);
@@ -157,8 +157,9 @@ handlecgi(int sock, char *file, char *port, char *base, cha…
printf("sel = %s; traverse = %s;\n", sel, traverse);
filec = xstrdup(file);
+ scriptc = xstrdup(file);
path = dirname(filec);
- script = path + strlen(path) + 1;
+ script = basename(scriptc);
if (sear == NULL)
sear = "";
@@ -189,6 +190,7 @@ handlecgi(int sock, char *file, char *port, char *base, cha…
default:
wait(NULL);
free(filec);
+ free(scriptc);
break;
}
}
@@ -199,7 +201,7 @@ handledcgi(int sock, char *file, char *port, char *base, ch…
char *sel, char *traverse)
{
FILE *fp;
- char *script, *path, *filec, *ln = NULL;
+ char *script, *path, *filec, *scriptc, *ln = NULL;
size_t linesiz = 0;
ssize_t n;
int outsocks[2], ret = 0;
@@ -216,8 +218,9 @@ handledcgi(int sock, char *file, char *port, char *base, ch…
return;
filec = xstrdup(file);
+ scriptc = xstrdup(file);
path = dirname(filec);
- script = path + strlen(path) + 1;
+ script = basename(scriptc);
if (sear == NULL)
sear = "";
@@ -276,6 +279,7 @@ handledcgi(int sock, char *file, char *port, char *base, ch…
fclose(fp);
wait(NULL);
free(filec);
+ free(scriptc);
break;
}
}
You are viewing proxied material from codemadness.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.