[fpc-pascal] GetTempFileName in Linux

Sven Barth pascaldragon at googlemail.com
Fri Oct 8 14:43:21 CEST 2010


Am 08.10.2010 14:11, schrieb Graeme Geldenhuys:
> On 8 October 2010 13:32, Sven Barth<pascaldragon at googlemail.com>  wrote:
>>
>> Let me guess: UID->username is a libc function...
>
> Problem is you can't always map a UID to a username under Unix. The
> username is not always in the /etc/passwd file. You can have LDAP (I
> think that's what it's called), Kerberos etc... users.  I noticed the
> same problem in fpGUI's file dialogs. So I wrapped that code in
> try..except calls. Try the local user (in /etc/passwd), if it fails to
> resolve, fall back to using the UID as is. On standard desktop linux
> this is 99% of the times ok, but in a large corporate environment
> things might be different.

I haven't thought about "network users", so thank you Graeme and Jonas 
for the explanation.

>
> Either way, using the UID should be fine too...or better that it currently is.
>
>

That's why I suggested at the end to provide a OnGetTempDir besides the 
OnGetTempFilename, so that only a part (e.g. tmp dir resolving) of 
GetTempFilename can be replaced.

Regards,
Sven



More information about the fpc-pascal mailing list