0

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.

sanmai
  • 29,083
  • 12
  • 64
  • 76

1 Answers1

2

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)
kaylum
  • 13,833
  • 2
  • 22
  • 31