Why does open() fails every time with EAGAIN?

429 Views Asked by At

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.

1

There are 1 best solutions below

0
On BEST ANSWER

11 is the file descriptor not an error code. Which means the open calls you are seeing have succeeded not failed. If open fails it will return -1 and strace would show something like this:

open("access.log", O_RDONLY)            = -1 ENOENT (No such file or directory)