[Lazarus] DeleteFile

Michael Van Canneyt michael at freepascal.org
Wed Nov 1 10:19:55 CET 2017



On Tue, 31 Oct 2017, Agustìn Gregorieu via Lazarus wrote:

> Hi!  I have a CGI program that must delete files from a server and it's
> owned by www-data which allows me to read a file but not to delete it,
> even though the file has permissions 777.  The folder containing the files
> I want to delete has permissions "drwxrwxrwx" and it's owned by
> "root:root" and it's files has the same characteristics.

You should check the return value of GetLastOSError.
If that does not tell you anything, try stracing your program.
For a cgi program, what I usually do is create a shell script
which I place instead of the actual binary:

#!/bin/sh
exec strace -o /tmp/cgi.log /path/to/real/cgi/program.bin

Michael.


More information about the Lazarus mailing list