Ver Fonte

fix: mg_fopen didn't fill in the file size

Daniel Rempel há 9 anos atrás
pai
commit
03ff1ef515
1 ficheiros alterados com 4 adições e 0 exclusões
  1. 4 0
      src/civetweb.c

+ 4 - 0
src/civetweb.c

@@ -1410,6 +1410,10 @@ mg_fopen(struct mg_connection *conn,
 
 
 	memset(filep, 0, sizeof(*filep));
 	memset(filep, 0, sizeof(*filep));
 
 
+	struct stat st;
+	if (stat(filename, &st) == 0)
+		filep->size = st.st_size;
+
 	if (!is_file_in_memory(conn, path, filep)) {
 	if (!is_file_in_memory(conn, path, filep)) {
 #ifdef _WIN32
 #ifdef _WIN32
 		wchar_t wbuf[PATH_MAX], wmode[20];
 		wchar_t wbuf[PATH_MAX], wmode[20];