From 19c94ce21879e24e736e3eacd160e37d01038d91 Mon Sep 17 00:00:00 2001 From: Sergey Lyubka Date: Tue, 17 Sep 2013 16:09:00 +0100 Subject: [PATCH] Fix for the issue 109 --- mongoose.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/mongoose.c b/mongoose.c index e8da616f..aa2ad680 100644 --- a/mongoose.c +++ b/mongoose.c @@ -1383,6 +1383,13 @@ static int mg_stat(struct mg_connection *conn, const char *path, filep->size = st.st_size; filep->modification_time = st.st_mtime; filep->is_directory = S_ISDIR(st.st_mode); + + // See https://github.com/cesanta/mongoose/issues/109 + // Some filesystems report modification time as 0. Artificially + // bump it up to mark mg_stat() success. + if (filep->modification_time == (time_t) 0) { + filep->modification_time = (time_t) 1; + } } else { filep->modification_time = (time_t) 0; }