浏览代码

Fix some warnings in Linux

bel 10 年之前
父节点
当前提交
fc76a4fa7e
共有 3 个文件被更改,包括 5 次插入2 次删除
  1. 2 1
      src/civetweb.c
  2. 1 1
      src/main.c
  3. 2 0
      src/mod_lua.inl

+ 2 - 1
src/civetweb.c

@@ -1149,6 +1149,7 @@ typedef struct tagTHREADNAME_INFO {
 #pragma pack(pop)
 #pragma pack(pop)
 #elif defined(__linux__)
 #elif defined(__linux__)
 #include <sys/prctl.h>
 #include <sys/prctl.h>
+#include <sys/sendfile.h>
 #endif
 #endif
 
 
 #if ((__GLIBC__ > 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 12)))
 #if ((__GLIBC__ > 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 12)))
@@ -5245,7 +5246,7 @@ static void send_file_data(struct mg_connection *conn,
 		mg_write(conn, filep->membuf + offset, (size_t)len);
 		mg_write(conn, filep->membuf + offset, (size_t)len);
 	} else if (len > 0 && filep->fp != NULL) {
 	} else if (len > 0 && filep->fp != NULL) {
 /* file stored on disk */
 /* file stored on disk */
-#if defined(LINUX)
+#if defined(__linux__)
 		/* TODO (high): Test sendfile for Linux */
 		/* TODO (high): Test sendfile for Linux */
 		if (conn->throttle == 0 && conn->ssl == 0) {
 		if (conn->throttle == 0 && conn->ssl == 0) {
 			off_t sf_offs = (off_t)offset;
 			off_t sf_offs = (off_t)offset;

+ 1 - 1
src/main.c

@@ -127,7 +127,7 @@ static struct tuser_data
 #endif
 #endif
 
 
 /* backup config file */
 /* backup config file */
-#if !defined(CONFIG_FILE2) && defined(LINUX)
+#if !defined(CONFIG_FILE2) && defined(__linux__)
 #define CONFIG_FILE2 "/usr/local/etc/civetweb.conf"
 #define CONFIG_FILE2 "/usr/local/etc/civetweb.conf"
 #endif
 #endif
 
 

+ 2 - 0
src/mod_lua.inl

@@ -1572,6 +1572,8 @@ static void lua_websocket_close(struct mg_connection *conn, void *ws_arg)
 	/* TODO: Delete lua_websock_data and remove it from the websocket list.
 	/* TODO: Delete lua_websock_data and remove it from the websocket list.
 	   This must only be done, when all connections are closed, and all
 	   This must only be done, when all connections are closed, and all
 	   asynchronous operations and timers are completed/expired. */
 	   asynchronous operations and timers are completed/expired. */
+	(void)shared_websock_list; /* shared_websock_list unused (see open TODO) */
+
 	(void)pthread_mutex_unlock(&ws->ws_mutex);
 	(void)pthread_mutex_unlock(&ws->ws_mutex);
 }
 }
 #endif
 #endif