From 025f10abf5e15c95df6befff6c1b3e20a2226919 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BA=90=E6=96=87=E9=9B=A8?= <41315874+fumiama@users.noreply.github.com> Date: Tue, 8 Jun 2021 16:18:30 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=9D=E8=AF=95=E4=BF=AE=E5=A4=8Dgetfilesize?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/server.c b/server.c index b8f8edc..1ff2de3 100644 --- a/server.c +++ b/server.c @@ -38,7 +38,7 @@ static void cat(int, FILE *); static void cannot_execute(int); static void error_die(const char *); static void execute_cgi(int, const char *, const char *, const char *); -static off_t get_file_size(const char *, int); +static uint32_t get_file_size(const char *, int); static int get_line(int, char *, int); static void handle_quit(int); static void headers(int, const char *); @@ -287,12 +287,12 @@ static void execute_cgi(int client, const char *path, const char *method, const /* Returns the size of a file. */ /* Parameters: path of the file */ /**********************************************************************/ -static off_t get_file_size(const char *filepath, int client) { +static uint32_t get_file_size(const char *filepath, int client) { struct stat statbuf; - off_t sz; + uint32_t sz; if (!stat(filepath, &statbuf)) { sz = statbuf.st_size; - printf("file size: %lu\n", sz); + printf("file size: %u\n", sz); return sz; } else {