Re: [fpc-pascal] GetTempFileName in Linux

2010-10-06 Thread Sven Barth
Am 05.10.2010 17:41, schrieb Jonas Maebe: On 05 Oct 2010, at 17:38, Michael Van Canneyt wrote: On Tue, 5 Oct 2010, Leonardo M. Ramé wrote: Hi, if I run this program from command line in Linux, I allways get the same result, /tmp/TMP0.tmp. Shouldn't it return a different file name each

Re: [fpc-pascal] Re: TProcess.Free - three exceptions in ntdll.dll - only *sometimes*

2010-10-06 Thread Sven Barth
Am 05.10.2010 21:08, schrieb Bernd Kreuss: On 05.10.2010 20:55, Bernd Kreuss wrote: I see this error message now exactly once, immediately *after* the DLL has been unloaded by the host application. Correction: I see it after my log output within my finalization section, it might still be in

Re: [fpc-pascal] GetTempFileName in Linux

2010-10-06 Thread Sven Barth
Am 05.10.2010 18:26, schrieb ik: On Tue, Oct 5, 2010 at 17:30, Sven Barth pascaldra...@googlemail.com mailto:pascaldra...@googlemail.com wrote: Am 05.10.2010 17:20, schrieb Leonardo M. Ramé: Hi, if I run this program from command line in Linux, I allways get the same

Re: [fpc-pascal] GetTempFileName in Linux

2010-10-06 Thread Michael Van Canneyt
On Wed, 6 Oct 2010, Sven Barth wrote: Am 05.10.2010 17:41, schrieb Jonas Maebe: On 05 Oct 2010, at 17:38, Michael Van Canneyt wrote: On Tue, 5 Oct 2010, Leonardo M. Ramé wrote: Hi, if I run this program from command line in Linux, I allways get the same result, /tmp/TMP0.tmp.

Re: [fpc-pascal] GetTempFileName in Linux

2010-10-06 Thread Jonas Maebe
On 06 Oct 2010, at 09:41, Michael Van Canneyt wrote: This is always true on Unix, the only way to make sure is to have the kernel create the temporary name and file for you. Unix - to my knowledge - does not have a way to create and lock a file in one atomic operation; There are always 2

Re: [fpc-pascal] GetTempFileName in Linux

2010-10-06 Thread Michael Van Canneyt
On Wed, 6 Oct 2010, Jonas Maebe wrote: On 06 Oct 2010, at 09:41, Michael Van Canneyt wrote: This is always true on Unix, the only way to make sure is to have the kernel create the temporary name and file for you. Unix - to my knowledge - does not have a way to create and lock a file in

Re: [fpc-pascal] GetTempFileName in Linux

2010-10-06 Thread Jonas Maebe
On 06 Oct 2010, at 11:05, Michael Van Canneyt wrote: On Wed, 6 Oct 2010, Jonas Maebe wrote: On 06 Oct 2010, at 09:41, Michael Van Canneyt wrote: This is always true on Unix, the only way to make sure is to have the kernel create the temporary name and file for you. Unix - to my knowledge

Re: [fpc-pascal] GetTempFileName in Linux

2010-10-06 Thread Michael Van Canneyt
On Wed, 6 Oct 2010, Jonas Maebe wrote: On 06 Oct 2010, at 11:05, Michael Van Canneyt wrote: On Wed, 6 Oct 2010, Jonas Maebe wrote: On 06 Oct 2010, at 09:41, Michael Van Canneyt wrote: This is always true on Unix, the only way to make sure is to have the kernel create the temporary name

Re: [fpc-pascal] GetTempFileName in Linux

2010-10-06 Thread Jonas Maebe
On 06 Oct 2010, at 11:59, Michael Van Canneyt wrote: On Wed, 6 Oct 2010, Jonas Maebe wrote: Nobody else can steal the file once you have created it, because they won't be the owner nor have the necessary permissions. That is the main security risk and it is solved by this approach. The

Re: [fpc-pascal] lNet getting the local IP

2010-10-06 Thread Sven Barth
Am 06.10.2010 14:49, schrieb Andrew Brunner: I just read the first line in /etc/hosts file. The first entry is the IPv4. On Tue, Oct 5, 2010 at 3:04 PM, Felipe Monteiro de Carvalho felipemonteiro.carva...@gmail.com wrote: hello, I am searching for a way to get the local IP. I already found

Re: [fpc-pascal] lNet getting the local IP

2010-10-06 Thread Felipe Monteiro de Carvalho
Ok, thanks everyone, it seams that I managed to extract a function from Silvio's code which doesn't use Synapse. I only tested in Windows so far: unit chesstcputils; {$mode objfpc}{$H+} interface uses {$IFDEF MSWINDOWS} Winsock, {$ENDIF} Classes, SysUtils; function ChessGetLocalIP():

Re: [fpc-pascal] lNet getting the local IP

2010-10-06 Thread Andrew Brunner
On Wed, Oct 6, 2010 at 7:55 AM, Sven Barth pascaldra...@googlemail.com wrote: You'll only find 127.0.0.1 for my computer there... I don't think that this is a very good solution. Oh well. That makes sense b/c these are servers that I have obtaining the same IP over DHCP. On clients when DHCP

Re: [fpc-pascal] lNet getting the local IP

2010-10-06 Thread Marco van de Voort
In our previous episode, Felipe Monteiro de Carvalho said: function ChessGetLocalIP(): string; VProcess.CommandLine := 'sh -c ifconfig eth0 | awk ''/inet end/ {print $3}'''; Fails if eth0 is not the primary NIC. Doesn't work on non-linux (that use other ethernet naming

Re: [fpc-pascal] lNet getting the local IP

2010-10-06 Thread Henry Vermaak
On 06/10/10 14:27, Felipe Monteiro de Carvalho wrote: Ok, thanks everyone, it seams that I managed to extract a function from Silvio's code which doesn't use Synapse. I only tested in Windows so far: unit chesstcputils; {$mode objfpc}{$H+} interface uses {$IFDEF MSWINDOWS} Winsock,

Re: [fpc-pascal] GetTempFileName in Linux

2010-10-06 Thread Jonathan
On Wed, 6 Oct 2010 09:41:03 +0200 (CEST) Michael Van Canneyt mich...@freepascal.org wrote: I'm open for some more sophisticated algorithm which does some more checking. Michael. Honour one of the temp directory environment variables, I know of TMPDIR, TEMP, TMP. I think it would be best to

Re: [fpc-pascal] lNet getting the local IP

2010-10-06 Thread Brian Winfrey
On Wed, Oct 6, 2010 at 7:09 AM, fpc-pascal-requ...@lists.freepascal.org wrote: Send fpc-pascal mailing list submissions to        fpc-pas...@lists.freepascal.org To subscribe or unsubscribe via the World Wide Web, visit        http://lists.freepascal.org/mailman/listinfo/fpc-pascal or, via