summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/client.c4
-rw-r--r--src/device.c2
-rw-r--r--src/log.c2
-rw-r--r--src/log.h2
-rw-r--r--src/main.c10
-rw-r--r--src/usb-linux.c6
6 files changed, 16 insertions, 10 deletions
diff --git a/src/client.c b/src/client.c
index ac1045a..d4a4a10 100644
--- a/src/client.c
+++ b/src/client.c
@@ -318,7 +318,7 @@ static int start_listen(struct mux_client *client)
318 count = device_get_list(devs); 318 count = device_get_list(devs);
319 319
320 // going to need a larger buffer for many devices 320 // going to need a larger buffer for many devices
321 int needed_buffer = count * (sizeof(struct usbmuxd_device_record) + sizeof(struct usbmuxd_header)) + REPLY_BUF_SIZE; 321 uint32_t needed_buffer = count * (sizeof(struct usbmuxd_device_record) + sizeof(struct usbmuxd_header)) + REPLY_BUF_SIZE;
322 if(client->ob_capacity < needed_buffer) { 322 if(client->ob_capacity < needed_buffer) {
323 usbmuxd_log(LL_DEBUG, "Enlarging client %d reply buffer %d -> %d to make space for device notifications", client->fd, client->ob_capacity, needed_buffer); 323 usbmuxd_log(LL_DEBUG, "Enlarging client %d reply buffer %d -> %d to make space for device notifications", client->fd, client->ob_capacity, needed_buffer);
324 client->ob_buf = realloc(client->ob_buf, needed_buffer); 324 client->ob_buf = realloc(client->ob_buf, needed_buffer);
@@ -464,7 +464,7 @@ static int client_command(struct mux_client *client, struct usbmuxd_header *hdr)
464 464
465static void process_send(struct mux_client *client) 465static void process_send(struct mux_client *client)
466{ 466{
467 int res; 467 uint32_t res;
468 if(!client->ob_size) { 468 if(!client->ob_size) {
469 usbmuxd_log(LL_WARNING, "Client %d OUT process but nothing to send?", client->fd); 469 usbmuxd_log(LL_WARNING, "Client %d OUT process but nothing to send?", client->fd);
470 client->events &= ~POLLOUT; 470 client->events &= ~POLLOUT;
diff --git a/src/device.c b/src/device.c
index 8c786a7..91712be 100644
--- a/src/device.c
+++ b/src/device.c
@@ -114,7 +114,7 @@ struct mux_device
114 114
115static struct collection device_list; 115static struct collection device_list;
116 116
117uint64_t mstime64(void) 117static uint64_t mstime64(void)
118{ 118{
119 struct timeval tv; 119 struct timeval tv;
120 gettimeofday(&tv, NULL); 120 gettimeofday(&tv, NULL);
diff --git a/src/log.c b/src/log.c
index 1973257..2d22e94 100644
--- a/src/log.c
+++ b/src/log.c
@@ -33,7 +33,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
33 33
34#include "log.h" 34#include "log.h"
35 35
36int log_level = LL_WARNING; 36unsigned int log_level = LL_WARNING;
37 37
38int log_syslog = 0; 38int log_syslog = 0;
39 39
diff --git a/src/log.h b/src/log.h
index eeefa41..1fb77ee 100644
--- a/src/log.h
+++ b/src/log.h
@@ -33,7 +33,7 @@ enum loglevel {
33 LL_FLOOD, 33 LL_FLOOD,
34}; 34};
35 35
36extern int log_level; 36extern unsigned int log_level;
37 37
38void log_enable_syslog(); 38void log_enable_syslog();
39void log_disable_syslog(); 39void log_disable_syslog();
diff --git a/src/main.c b/src/main.c
index de5e5cc..32c6a2b 100644
--- a/src/main.c
+++ b/src/main.c
@@ -64,7 +64,7 @@ static int daemon_pipe;
64 64
65static int report_to_parent = 0; 65static int report_to_parent = 0;
66 66
67int create_socket(void) { 67static int create_socket(void) {
68 struct sockaddr_un bind_addr; 68 struct sockaddr_un bind_addr;
69 int listenfd; 69 int listenfd;
70 70
@@ -98,7 +98,7 @@ int create_socket(void) {
98 return listenfd; 98 return listenfd;
99} 99}
100 100
101void handle_signal(int sig) 101static void handle_signal(int sig)
102{ 102{
103 if (sig != SIGUSR1 && sig != SIGUSR2) { 103 if (sig != SIGUSR1 && sig != SIGUSR2) {
104 usbmuxd_log(LL_NOTICE,"Caught signal %d, exiting", sig); 104 usbmuxd_log(LL_NOTICE,"Caught signal %d, exiting", sig);
@@ -124,7 +124,7 @@ void handle_signal(int sig)
124 } 124 }
125} 125}
126 126
127void set_signal_handlers(void) 127static void set_signal_handlers(void)
128{ 128{
129 struct sigaction sa; 129 struct sigaction sa;
130 sigset_t set; 130 sigset_t set;
@@ -162,7 +162,7 @@ static int ppoll(struct pollfd *fds, nfds_t nfds, const struct timespec *timeout
162} 162}
163#endif 163#endif
164 164
165int main_loop(int listenfd) 165static int main_loop(int listenfd)
166{ 166{
167 int to, cnt, i, dto; 167 int to, cnt, i, dto;
168 struct fdlist pollfds; 168 struct fdlist pollfds;
@@ -519,7 +519,7 @@ int main(int argc, char *argv[])
519 goto terminate; 519 goto terminate;
520 } 520 }
521 sprintf(pids, "%d", getpid()); 521 sprintf(pids, "%d", getpid());
522 if ((res = write(lfd, pids, strlen(pids))) != strlen(pids)) { 522 if ((size_t)(res = write(lfd, pids, strlen(pids))) != strlen(pids)) {
523 usbmuxd_log(LL_FATAL, "Could not write pidfile!"); 523 usbmuxd_log(LL_FATAL, "Could not write pidfile!");
524 if(res >= 0) 524 if(res >= 0)
525 res = -2; 525 res = -2;
diff --git a/src/usb-linux.c b/src/usb-linux.c
index 334d967..f937de0 100644
--- a/src/usb-linux.c
+++ b/src/usb-linux.c
@@ -121,6 +121,9 @@ static void tx_callback(struct libusb_transfer *xfer)
121 usbmuxd_log(LL_ERROR, "TX transfer overflow for device %d-%d", dev->bus, dev->address); 121 usbmuxd_log(LL_ERROR, "TX transfer overflow for device %d-%d", dev->bus, dev->address);
122 break; 122 break;
123 // and nothing happens (this never gets called) if the device is freed after a disconnect! (bad) 123 // and nothing happens (this never gets called) if the device is freed after a disconnect! (bad)
124 default:
125 // this should never be reached.
126 break;
124 } 127 }
125 // we can't usb_disconnect here due to a deadlock, so instead mark it as dead and reap it after processing events 128 // we can't usb_disconnect here due to a deadlock, so instead mark it as dead and reap it after processing events
126 // we'll do device_remove there too 129 // we'll do device_remove there too
@@ -190,6 +193,9 @@ static void rx_callback(struct libusb_transfer *xfer)
190 usbmuxd_log(LL_ERROR, "RX transfer overflow for device %d-%d", dev->bus, dev->address); 193 usbmuxd_log(LL_ERROR, "RX transfer overflow for device %d-%d", dev->bus, dev->address);
191 break; 194 break;
192 // and nothing happens (this never gets called) if the device is freed after a disconnect! (bad) 195 // and nothing happens (this never gets called) if the device is freed after a disconnect! (bad)
196 default:
197 // this should never be reached.
198 break;
193 } 199 }
194 free(xfer->buffer); 200 free(xfer->buffer);
195 dev->rx_xfer = NULL; 201 dev->rx_xfer = NULL;