shithub: git9

Download patch

ref: 193585c1d2818f646347112363f712a43d0b9c2c
parent: 882bbb257682215300e7eb10dca1a4e38c7e9f11
author: Ori Bernstein <[email protected]>
date: Sun Sep 6 13:28:14 EDT 2020

serve: clean up debug prints

--- a/serve.c
+++ b/serve.c
@@ -143,7 +143,6 @@
 	dprint(1, "finding twixt\n");
 	if(findtwixt(head, nhead, tail, ntail, &obj, &nobj) == -1)
 		sysfatal("twixt: %r");
-	fprint(2, "DPRINT!\n");
 	dprint(1, "writing pack\n");
 	if(nobj > 0 && writepack(c->wfd, obj, nobj, &h) == -1)
 		sysfatal("send: %r");
@@ -450,7 +449,7 @@
 	if(snprint(path, sizeof(path), "%s/%s", pathpfx, p) == sizeof(path))
 		sysfatal("%s: path too long\n", p);
 	cleanname(path);
-	if(strncmp(path, pathpfx) != 0)
+	if(strncmp(pathpfx, path, strlen(pathpfx)) != 0)
 		sysfatal("%s: path escapes prefix");
 	if(chdir(path) == -1)
 		sysfatal("cd %s: %r", p);