Permalink
Browse files

fix `Failed to stat` error w/ LoadFromFile ngx#972

If you turn on LoadFromFile then 404s turn into errors in the log. These
shouldn't be errors, so don't log unless we see an errno which isn't ENOENT.
  • Loading branch information...
crowell committed May 29, 2015
1 parent cf5ba4e commit 3d44cc7bdaf3e4250a9d0c1f201d76c4de1de857
Showing with 5 additions and 4 deletions.
  1. +5 −4 pagespeed/kernel/base/stdio_file_system.cc
@@ -423,11 +423,12 @@ bool StdioFileSystem::Stat(const StringPiece& path, struct stat* statbuf,
const char* path_str = path_string.c_str();
if (stat(path_str, statbuf) == 0) {
return true;
} else {
handler->Message(kError, "Failed to stat %s: %s",
path_str, strerror(errno));
return false;
} else if (errno != ENOENT) { // Not an error if file doesn't exist see #972.
// https://github.com/pagespeed/ngx_pagespeed/issues/972
handler->Message(kError, "Failed to stat %s: %s", path_str,
strerror(errno));
}
return false;
}

// TODO(abliss): there are some situations where this doesn't work

0 comments on commit 3d44cc7

Please sign in to comment.