1
0
mirror of https://github.com/fumiama/simple-http-server.git synced 2026-06-12 06:00:41 +08:00

增大打印长度

This commit is contained in:
源文雨
2021-06-07 22:56:45 +08:00
parent 4a65c8d66b
commit f6c1ca30f6

View File

@@ -292,11 +292,11 @@ void execute_cgi(int client, const char *path, const char *method, const char *q
off_t get_file_size(const char *filepath) { off_t get_file_size(const char *filepath) {
struct stat statbuf; struct stat statbuf;
if (stat(filepath, &statbuf) == 0) { if (stat(filepath, &statbuf) == 0) {
printf("file size: %u\n", statbuf.st_size); printf("file size: %lu\n", statbuf.st_size);
if(statbuf.st_size == 0) { if(statbuf.st_size == 0) {
FILE* fp = fopen(filepath, "ab+"); FILE* fp = fopen(filepath, "ab+");
off_t sz = ftell(fp); off_t sz = ftell(fp);
printf("ftell size: %u\n", sz); printf("ftell size: %lu\n", sz);
return sz; return sz;
} }
return statbuf.st_size; return statbuf.st_size;