diff --git a/server/socket_server.c b/server/socket_server.c index a56e58a..0921a64 100644 --- a/server/socket_server.c +++ b/server/socket_server.c @@ -269,12 +269,12 @@ enum socket_result serve_one_request(int sock_fd) { } // Attempt to read the file and return it. struct requested_file file = {}; - int file_result = get_file_from_uri(parsed_request_line.uri, &file); - if (file_result != RESULT_FILE_OK) { + enum file_result file_get_result = get_file_from_uri(parsed_request_line.uri, &file); + if (file_get_result != RESULT_FILE_OK) { int send_result = 0; - if (file_result == RESULT_NOT_FILE || (file_result == RESULT_IO_ERROR && errno == ENOENT)) { + if (file_get_result == RESULT_NOT_FILE || (file_get_result == RESULT_IO_ERROR && errno == ENOENT)) { send_result = send_headers(404, client_fd, -1); - } else if (file_result == RESULT_IO_ERROR && errno == EACCES) { + } else if (file_get_result == RESULT_IO_ERROR && errno == EACCES) { send_result = send_headers(403, client_fd, -1); } else { free_request_line_items(&parsed_request_line); @@ -298,7 +298,7 @@ enum socket_result serve_one_request(int sock_fd) { } free_request_line_items(&parsed_request_line); free_request_items(message); - if (file_result == RESULT_FILE_OK) { + if (file_get_result == RESULT_FILE_OK) { fclose(file.file); }