Skip to content
This repository was archived by the owner on Apr 10, 2025. It is now read-only.

Commit 3d44cc7

Browse files
committed
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.
1 parent cf5ba4e commit 3d44cc7

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

Diff for: pagespeed/kernel/base/stdio_file_system.cc

+5-4
Original file line numberDiff line numberDiff line change
@@ -423,11 +423,12 @@ bool StdioFileSystem::Stat(const StringPiece& path, struct stat* statbuf,
423423
const char* path_str = path_string.c_str();
424424
if (stat(path_str, statbuf) == 0) {
425425
return true;
426-
} else {
427-
handler->Message(kError, "Failed to stat %s: %s",
428-
path_str, strerror(errno));
429-
return false;
426+
} else if (errno != ENOENT) { // Not an error if file doesn't exist see #972.
427+
// https://github.com/pagespeed/ngx_pagespeed/issues/972
428+
handler->Message(kError, "Failed to stat %s: %s", path_str,
429+
strerror(errno));
430430
}
431+
return false;
431432
}
432433

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

0 commit comments

Comments
 (0)