aboutsummaryrefslogtreecommitdiff
path: root/src/examples/fileserver_example.c
diff options
context:
space:
mode:
authorEvgeny Grin (Karlson2k) <k2k@narod.ru>2022-06-01 16:15:08 +0300
committerEvgeny Grin (Karlson2k) <k2k@narod.ru>2022-06-01 22:12:37 +0300
commit93dcf8ea912ceb2eb83b73a7e5165a08c4db9312 (patch)
treefa6d756e8a65120a715a17621d6ed3244c14b215 /src/examples/fileserver_example.c
parent74c2eba238ff26788eae3afac68307f49a82099b (diff)
downloadlibmicrohttpd-93dcf8ea912ceb2eb83b73a7e5165a08c4db9312.tar.gz
libmicrohttpd-93dcf8ea912ceb2eb83b73a7e5165a08c4db9312.zip
src/examples: muted compiler warnings
Diffstat (limited to 'src/examples/fileserver_example.c')
-rw-r--r--src/examples/fileserver_example.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/examples/fileserver_example.c b/src/examples/fileserver_example.c
index e300f6ed..ee80d632 100644
--- a/src/examples/fileserver_example.c
+++ b/src/examples/fileserver_example.c
@@ -100,7 +100,7 @@ ahc_echo (void *cls,
100 } 100 }
101 else 101 else
102 { 102 {
103 response = MHD_create_response_from_fd64 (buf.st_size, fd); 103 response = MHD_create_response_from_fd64 ((uint64_t) buf.st_size, fd);
104 if (NULL == response) 104 if (NULL == response)
105 { 105 {
106 if (0 != close (fd)) 106 if (0 != close (fd))
@@ -118,15 +118,24 @@ int
118main (int argc, char *const *argv) 118main (int argc, char *const *argv)
119{ 119{
120 struct MHD_Daemon *d; 120 struct MHD_Daemon *d;
121 int port;
121 122
122 if (argc != 2) 123 if (argc != 2)
123 { 124 {
124 printf ("%s PORT\n", argv[0]); 125 printf ("%s PORT\n", argv[0]);
125 return 1; 126 return 1;
126 } 127 }
128 port = atoi (argv[1]);
129 if ( (1 > port) || (port > 65535) )
130 {
131 fprintf (stderr,
132 "Port must be a number between 1 and 65535.\n");
133 return 1;
134 }
135
127 d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION 136 d = MHD_start_daemon (MHD_USE_THREAD_PER_CONNECTION
128 | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, 137 | MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG,
129 atoi (argv[1]), 138 (uint16_t) port,
130 NULL, NULL, &ahc_echo, NULL, MHD_OPTION_END); 139 NULL, NULL, &ahc_echo, NULL, MHD_OPTION_END);
131 if (d == NULL) 140 if (d == NULL)
132 return 1; 141 return 1;