Re: g_get_home_dir, g_get_tmp_dir



On Oct 28, Tor Lillqvist wrote:
> I think this is how g_get_home_dir should work:
> 
> /* Return the home directory of the user. If there is a HOME
>  * environment variable, its value is returned, otherwise use some
>  * system-dependent way of finding it out. If no home directory can be
>  * deduced, return an empty string.
>  */

Should HOME be used on a Unix system in preference to querying
someone's home directory via the UID/EUID of the process, and using
getpwuid() ?

> And g_get_tmp_dir:
> 
> /* Return a directory to be used to temporary files. This is the value
>  * of the TMPDIR, TMP or TEMP environment variables (they are checked
>  * in that order). If none of those exist, return "/tmp" on POSIXly
>  * systems, and "." (the current directory) on Windows.
>  */
 
What about using P_tmpdir from <stdio.h> if it's defined, rather than
/tmp?  Using /tmp on Solaris, for example is a bad idea, since that's 
your swap space.  At the very least, "/var/tmp" should be used.

-- 
Des Herriott
des@ops.netcom.net.uk



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