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

From:
Tracey Emery <tracey@traceyemery.net>
Subject:
Re: got_diffreg temporary patch
To:
gameoftrees@openbsd.org
Date:
Sat, 25 Jan 2020 09:00:34 -0700

Download raw body.

Thread
On Sat, Jan 25, 2020 at 11:14:36AM +0100, Stefan Sperling wrote:
> Won't this change leave empty files around in /tmp? The temp files will
> be closed but won't be removed from disk.

No files are visible to the filesystem with got_opentemp. The file is
unlinked immediately.

> 
> I think leaving f1 or f2 as NULL and checking for NULL everywhere else
> inside the diffreg code would be a better solution.
>  

I agree. I'm just not going to get time this weekend to hack on that, so
it is just a suggested temporary fix.

> > 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;
> > 
> > 

-- 

Tracey Emery