[Lazarus] Cannot save file to NFS mounted path

Mattias Gaertner nc-gaertnma at netcologne.de
Thu Aug 4 17:03:18 CEST 2016


On Thu, 4 Aug 2016 07:59:14 -0300
Leonardo M. Ramé <l.rame at griensu.com> wrote:

>[...]
> mounted NFS one.
> 
> I must add the user has write permissions on the mounted path, in fact 
> before posting this I've tried creating a text file without using 
> TFileStream and it worked without an issue, so I assume the problem is 
> with TFileStream:
> 
>      // This works:
> 
>      AssignFile(f, '/mnt/data_vultr/documents/test.txt');
>      {$I-}
>      Rewrite(f);
>      {$I+}
>      if IOResult =0 then
>      begin
>        System.WriteLn(f, 'aaaa');
>        System.WriteLn(f, 'bbb');
>      end;
>      System.Close(f);
> 
> 
>      // this doesn't work
> 
>      lFileStream := TFileStream.Create(lFile, fmCreate);

Try
lFileStream := TFileStream.Create(lFile, fmCreate or fmShareDenyNone);

NFS often does not support locking.

>      AMemStream.Position := 0;
>      lFileStream.CopyFrom(AMemStream,AMemStream.Size);

Mattias


More information about the Lazarus mailing list