Can anyone please explain to me why I cannot open file for writing (macOS) under /Library/Logs/DiagnosticReports (no matter the reason).
I know that this directory is owned by root, but when I'm using the terminal with the command touch foo, the file does get created without any problems (and I'm running as the same non-root user).
And when I'm trying to use the open syscall in my C program, I get error 2 (which is access denied).
That's the code that causes the error.
fd = open(path, O_RDWR);
Would like to know if there's a different between me running this program and me using the terminal to write to a file (again, same user)