"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Tracey Emery <tracey@traceyemery.net>
Subject:
got_diffreg temporary patch
To:
gameoftrees@openbsd.org
Date:
Fri, 24 Jan 2020 13:56:27 -0700

Download raw body.

Thread
Hello,

During some clean-up of gotweb's diffing, I traced down a problem in
got_diffreg, which I discussed with stsp. The problem is that /dev/null
is opened when a file is NULL during diffing.

Naturally, this device doesn't exist in the httpd(8) chroot, so when the
function is called, diffing is terminated in gotweb resulting in
incomplete diffs.

I'd like to get this temporary patch in until more time is available for
hacking a better solution. This way, if someone wants to play with
gotweb in the interem, the user will get full diffs.

Ok?

-- 

Tracey Emery

diff 65559f29d05d29688f1aaca93a9398148be5154b /home/basepr1me/Documents/got/got/got
blob - ba57c9a9820650433f49ef21d5eff17b52d34763
file + lib/diffreg.c
--- lib/diffreg.c
+++ lib/diffreg.c
@@ -92,6 +92,12 @@
 
 #include "got_lib_diff.h"
 
+/* 
+ * XXX:band-aid patch include
+ * remove when proper patch in place
+ */
+#include <got_opentemp.h>
+
 #define MINIMUM(a, b)	(((a) < (b)) ? (a) : (b))
 #define MAXIMUM(a, b)	(((a) > (b)) ? (a) : (b))
 
@@ -305,7 +311,7 @@ got_diffreg(int *rval, FILE *f1, FILE *f2, int flags,
 		return NULL;
 	}
 	if (flags & D_EMPTY1) {
-		f1 = fopen(_PATH_DEVNULL, "r");
+		f1 = got_opentemp();
 		if (f1 == NULL) {
 			err = got_error_from_errno2("fopen", _PATH_DEVNULL);
 			goto closem;
@@ -317,7 +323,7 @@ got_diffreg(int *rval, FILE *f1, FILE *f2, int flags,
 	}
 
 	if (flags & D_EMPTY2) {
-		f2 = fopen(_PATH_DEVNULL, "r");
+		f2 = got_opentemp();
 		if (f2 == NULL) {
 			err = got_error_from_errno2("fopen", _PATH_DEVNULL);
 			goto closem;