shithub: front

Download patch

ref: 473f56751bd725580802c936ac27978bf071f37d
parent: fbf9f5fe25e7febf65e9d235b4db8176139e3a36
author: Ori Bernstein <ori@eigenstate.org>
date: Mon May 26 10:43:49 EDT 2025

patch: cleanname of paths

in addition to slightly cleaner errors, it makes our
guess at whether the output file is the same as the
input file slightly more reliable, leading to better
behavior around replacing the output vs erroring that
the file already exists.

--- a/sys/src/cmd/patch.c
+++ b/sys/src/cmd/patch.c
@@ -151,6 +151,8 @@
 	h->newlen = 0;
 	h->newsz = 32;
 	h->new = emalloc(h->newsz);
+	cleanname(h->oldpath);
+	cleanname(h->newpath);
 	if(strncmp(s, "@@ -", 4) != 0)
 		return -1;
 	e = s + 4;
--