[vlc-devel] [PATCH v2 3/13] platform: avoid hard coded temp dir path in vlc_memfd()

Lyndon Brown jnqnfe at gmail.com
Wed Oct 7 02:49:16 CEST 2020


On Tue, 2020-10-06 at 23:27 +0300, Rémi Denis-Courmont wrote:
> Le tiistaina 6. lokakuuta 2020, 23.12.51 EEST Lyndon Brown a écrit :
> > We can't just do a getenv() call only though instead;
> 
> Sure you can. getenv() and NULL comparison. No strdup() involved.
> 
> > Many linux
> > distros (like mine) leave $TMPDIR unset, so we'd need to grab the
> > env
> > var, then replace with "/tmp" if null.
> 
> And so ... ?

I was merely commenting on the basis that you'd only mentioned getenv()
not the "/tmp" fallback.

As long as you're happy that we'll have this:
```
char *tempdir = getenv("TMPDIR");
if (tempdir == NULL)
    tempdir = "/tmp";
```
rather than just:
```
char *tempdir = getenv("TMPDIR");
```
as I expect you are, then there's no problem. That's all.



More information about the vlc-devel mailing list