gnunet-developers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [GNUnet-developers] using $TMPDIR instead of /tmp


From: Nils Gillmann
Subject: Re: [GNUnet-developers] using $TMPDIR instead of /tmp
Date: Mon, 7 May 2018 08:45:13 +0000

Christian Grothoff transcribed 3.9K bytes:
> On 05/07/2018 10:03 AM, Nils Gillmann wrote:
> > I've just started looking into our C code, and C in general, more.
> > In src/transport/gnunet-helper-transport-wlan-dummy.c
> > we define 2 fifo files (FIFO_FILE1, FIFO_FILE2). Those are currently
> > #define FIFO_FILE1 "/tmp/test-transport/api-wlan-p1/WLAN_FIFO_in"
> > #define FIFO_FILE1 "/tmp/test-transport/api-wlan-p1/WLAN_FIFO_out"
> > 
> > Would
> > 
> > #define FIFO_FILE1 GNUNET_DISK_mktemp("test-transport/api-wlan-p1/") 
> > "WLAN_FIFO_in"
> > 
> > work? 
> 
> Eh, no. This shouldn't even compile. C is not a script language, and
> foo() "bar" is not syntactically valid even if foo() returns a char*.
> 
> Also, even if it did, you'd create a memory leak.  To do this right, you
> have to replace all uses of the macro with something like:
> 
> char *tdir;
> char *dir;
> 
> tdir = GNUNET_DISK_mktemp ("foo");
> GNUNET_asprintf (&dir, "%sWLAN_FIFO_in", tdir);
> GNUNET_free (tdir);
> // use (dir);  -> was: use (FIFO_FILE1);
> GNUNET_free (dir);
> 
> > the tests are still failing with this, but it seems like the right 
> > directories
> > and files are created.
> > 
> > test-suite.log (one file still had "/tmp" but in the right location, via 
> > GNUNET_DISK_mktemp:
> 


Hm.. crap. I can't fix or read anything for a couple of hours now,
sorry for my amateur try at fixing the C part of the test-suite.
I'll read a bit more before my next attempt. Also lack of sleep.

> _______________________________________________
> GNUnet-developers mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/gnunet-developers




reply via email to

[Prev in Thread] Current Thread [Next in Thread]