Repository: trafficserver
Updated Branches:
  refs/heads/master cb3d5f4ea -> 59cb07065


TS-4057: missing check for system call error

EPERM and EACCES are often consfused for each other.

EPERM means "operation not permitted", ie doing this would not be
in your best interest.  EACCES means "permission denied", meaning
if you run this command as sudo it will work. Posix specifies that
open(2) returns EACCES.

Opening a log file will _probably_ never be bad, and even if the
system says so, it shouldn't be bad. So in this case it doesn't
hurt to leave both conditions in here.


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/59cb0706
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/59cb0706
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/59cb0706

Branch: refs/heads/master
Commit: 59cb070654a6e6a7acdd6509a770478d413f79a6
Parents: cb3d5f4
Author: Daniel Xu <[email protected]>
Authored: Mon Dec 7 17:03:14 2015 +0000
Committer: James Peach <[email protected]>
Committed: Mon Dec 7 09:30:28 2015 -0800

----------------------------------------------------------------------
 proxy/Main.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/59cb0706/proxy/Main.cc
----------------------------------------------------------------------
diff --git a/proxy/Main.cc b/proxy/Main.cc
index 0859603..8efbb18 100644
--- a/proxy/Main.cc
+++ b/proxy/Main.cc
@@ -1420,7 +1420,7 @@ static int
 elevating_open(char const *path, unsigned int flags, unsigned int fperms)
 {
   int fd = open(path, flags, fperms);
-  if (fd < 0 && EPERM == errno) {
+  if (fd < 0 && (EPERM == errno || EACCES == errno)) {
     ElevateAccess access;
     fd = open(path, flags, fperms);
   }

Reply via email to