diff --git a/Makefile b/Makefile index 2f08a51..d2c3eca 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ -PREFIX=/usr/local +PREFIX?=/usr/local INC=-I$(PREFIX)/include LIB=-L$(PREFIX)/lib -L. -lpidfile -CFLAGS=-Wall -g -O2 -pipe -funroll-loops -ffast-math -fno-strict-aliasing +CFLAGS=-Wall -Wextra -g -O2 -pipe -funroll-loops -ffast-math -fno-strict-aliasing CC?=cc AR?=AR RANLIB?=ranlib @@ -20,5 +20,5 @@ fsipd: fsipd.c $(LIBPIDFILE) $(CC) $(CFLAGS) $(INC) $(LIB) fsipd.c -o fsipd clean: - rm -f *.o a.out core temp.* $(LIBPIDFILE) $(PROGS) + rm -f *.o *.a a.out core temp.* $(LIBPIDFILE) $(PROGS) rm -fr *.dSYM \ No newline at end of file diff --git a/fsipd.c b/fsipd.c index d4fca6d..57af751 100644 --- a/fsipd.c +++ b/fsipd.c @@ -32,6 +32,7 @@ #include #include #include +#include #include #include @@ -89,12 +90,8 @@ process_request(char *str) { /* check input str for SIP requests */ - /* - * TODO: log connection info including SRC/DST IP, SRC/DST PORT, - * Timestamp and Message Type in CSV Format - */ - - syslog(LOG_ALERT, "incoming packet: %s\n", str); + syslog(LOG_ALERT, "sip: %s, sport: %d, payload: \"%s\"\n", + inet_ntoa(sa.sin_addr), ntohs(sa.sin_port), str); } /* @@ -208,7 +205,7 @@ daemon_start() } int -main(int argc, char *argv[]) +main(void) { return (daemon_start()); } diff --git a/pidfile.c b/pidfile.c index 48d3271..9e44eeb 100644 --- a/pidfile.c +++ b/pidfile.c @@ -125,7 +125,8 @@ struct pidfh *pidfile_open(const char *path, mode_t mode, pid_t *pidptr) struct pidfh *pfh; struct timespec rqtp; struct stat sb; - int len, fd, error, count; + size_t len; + int fd, error, count; pfh = malloc(sizeof(*pfh)); if (pfh == NULL) return NULL;