Declaration fixes and so on - for compilling with -Werror --- src/daemon.c +++ src/daemon.c @@ -51,7 +51,8 @@ int acceptloop(int sock) { - int connect, pid, len; + int connect, pid; + socklen_t len; struct sockaddr_in client; /* --- src/ftp.c +++ src/ftp.c @@ -115,7 +115,7 @@ ftpcmd_t cmdtab[] = { unsigned get_interface_info(int pfd, char *ip, int max) { - int size; + socklen_t size; unsigned int port; struct sockaddr_in saddr; @@ -133,7 +133,7 @@ unsigned get_interface_info(int pfd, char *ip, int max) int get_client_info(ftp_t *x, int pfd) { - int size; + socklen_t size; struct sockaddr_in saddr; struct in_addr *addr; struct hostent *hostp = NULL; @@ -274,7 +274,8 @@ int getc_fd(ftp_t *x, int fd) } else if (FD_ISSET(x->ch.active, &available)) { if (x->ch.state == PORT_LISTEN) { - int sock, adrlen; + int sock; + socklen_t adrlen; struct sockaddr_in adr; earlyreported = 0; @@ -509,12 +510,17 @@ char *cfgets(ftp_t *x, char *line, int size) int cfputs(ftp_t *x, char *line) { char buffer[310]; + ssize_t len; if (debug) fprintf (stderr, ">>> CLI: %s\n", line); snprintf (buffer, sizeof(buffer) - 2, "%s\r\n", line); - write(1, buffer, strlen(buffer)); + len = strlen(buffer); + if (write(1, buffer, strlen(buffer)) != len) { + syslog(LOG_NOTICE, "-ERR: error writing to STDOUT, error= %s", strerror(errno)); + exit (1); + }; return (0); } @@ -767,7 +773,7 @@ int dopasv(ftp_t *x, char *command, char *par) while (k > 0 && isdigit(line[k-1]) == 0) k--; - if (isdigit(line[k-1])) { + if (k > 0 && isdigit(line[k-1])) { line[k--] = 0; while (k > 0 && (isdigit(line[k-1]) || line[k-1] == ',')) k--; @@ -1823,7 +1829,7 @@ int proxy_request(config_t *config) syslog(LOG_NOTICE, "%s %s: %ld bytes", x->ch.command, x->ch.filename, x->ch.bytes); if (x->xlfp != NULL) { - unsigned long now; + time_t now; char date[80]; /* --- src/lib.c +++ src/lib.c @@ -183,7 +183,7 @@ char *skip_ws(char *string) char *noctrl(char *buffer) { int len, i; - unsigned char *p; + char *p; // TODO: Use iscntrl here. iscntrl(32) returns 0 so figure out why space is converted to null byte too. if ((p = buffer) == NULL) @@ -202,7 +202,7 @@ char *noctrl(char *buffer) char *get_word(char **from, char *to, int maxlen) { unsigned int c; - unsigned char *p; + char *p; int k; maxlen -= 2;