Why would a program like Apache fail to open a plain file? Running it under strace
shows:
open("access.log", O_WRONLY|O_CREAT|O_APPEND|O_CLOEXEC, 0666) = 11
11
stands for either EAGAIN
or EWOULDBLOCK
Where:
$ ls -l access.log
-rw-rw-rw- 1 root root 2 Jun 9 17:52 access.log
If I su
as www-data
I can write to the file safely.
11
is the file descriptor not an error code. Which means theopen
calls you are seeing have succeeded not failed. Ifopen
fails it will return-1
and strace would show something like this: