git » nmdb » commit c91455c

Remove remaining printf()s and perror() with the new logging functions.

author Alberto Bertogli
2007-08-08 21:50:04 UTC
committer Alberto Bertogli
2007-08-08 21:50:04 UTC
parent f31fe4959b5504330508012b1829369a0f5f86b6

Remove remaining printf()s and perror() with the new logging functions.

Signed-off-by: Alberto Bertogli <albertito@gmail.com>

nmdb/dbloop.c +3 -3
nmdb/tcp.c +2 -2
nmdb/tipc.c +2 -2
nmdb/udp.c +2 -2

diff --git a/nmdb/dbloop.c b/nmdb/dbloop.c
index 11eed52..5140ca9 100644
--- a/nmdb/dbloop.c
+++ b/nmdb/dbloop.c
@@ -2,7 +2,6 @@
 #include <pthread.h>		/* threading functions */
 #include <time.h>		/* nanosleep() */
 #include <errno.h>		/* ETIMEDOUT */
-#include <stdio.h>		/* perror() */
 #include <string.h>		/* memcmp() */
 #include <stdlib.h>		/* malloc()/free() */
 
@@ -12,6 +11,7 @@
 #include "queue.h"
 #include "net-const.h"
 #include "req.h"
+#include "log.h"
 
 
 static void *db_loop(void *arg);
@@ -71,7 +71,7 @@ static void *db_loop(void *arg)
 		}
 
 		if (rv != 0 && rv != ETIMEDOUT) {
-			perror("Error in queue_timedwait()");
+			errlog("Error in queue_timedwait()");
 			continue;
 		}
 
@@ -174,7 +174,7 @@ static void process_op(db_t *db, struct queue_entry *e)
 		free(dbval);
 
 	} else {
-		printf("Unknown op 0x%x\n", e->operation);
+		wlog("Unknown op 0x%x\n", e->operation);
 	}
 }
 
diff --git a/nmdb/tcp.c b/nmdb/tcp.c
index 9d22ba0..555241c 100644
--- a/nmdb/tcp.c
+++ b/nmdb/tcp.c
@@ -2,7 +2,6 @@
 #include <sys/types.h>		/* socket defines */
 #include <sys/socket.h>		/* socket functions */
 #include <stdlib.h>		/* malloc() */
-#include <stdio.h>		/* perror() */
 #include <stdint.h>		/* uint32_t and friends */
 #include <arpa/inet.h>		/* htonls() and friends */
 #include <netinet/in.h>		/* INET stuff */
@@ -23,6 +22,7 @@ typedef unsigned char u_char;
 #include "net-const.h"
 #include "req.h"
 #include "parse.h"
+#include "log.h"
 
 
 /* TCP socket structure. Used mainly to hold buffers from incomplete
@@ -101,7 +101,7 @@ static void rep_send_error(const struct req_info *req, const unsigned int code)
 	r = send(req->fd, minibuf, 4 * 4, 0);
 
 	if (r < 0) {
-		perror("rep_send_error() failed");
+		errlog("rep_send_error() failed");
 	}
 }
 
diff --git a/nmdb/tipc.c b/nmdb/tipc.c
index eb73bc4..3862106 100644
--- a/nmdb/tipc.c
+++ b/nmdb/tipc.c
@@ -3,7 +3,6 @@
 #include <sys/socket.h>		/* socket functions */
 #include <stdlib.h>		/* malloc() */
 #include <linux/tipc.h>		/* tipc stuff */
-#include <stdio.h>		/* perror() */
 #include <stdint.h>		/* uint32_t and friends */
 #include <arpa/inet.h>		/* htonls() and friends */
 #include <string.h>		/* memcpy() */
@@ -14,6 +13,7 @@
 #include "net-const.h"
 #include "req.h"
 #include "parse.h"
+#include "log.h"
 
 
 static void tipc_mini_reply(struct req_info *req, uint32_t reply);
@@ -48,7 +48,7 @@ static void rep_send_error(const struct req_info *req, const unsigned int code)
 	r = sendto(req->fd, minibuf, 3 * 4, 0, req->clisa, req->clilen);
 
 	if (r < 0) {
-		perror("rep_send_error() failed");
+		errlog("rep_send_error() failed");
 	}
 }
 
diff --git a/nmdb/udp.c b/nmdb/udp.c
index 29cb789..aca8081 100644
--- a/nmdb/udp.c
+++ b/nmdb/udp.c
@@ -2,7 +2,6 @@
 #include <sys/types.h>		/* socket defines */
 #include <sys/socket.h>		/* socket functions */
 #include <stdlib.h>		/* malloc() */
-#include <stdio.h>		/* perror() */
 #include <stdint.h>		/* uint32_t and friends */
 #include <arpa/inet.h>		/* htonls() and friends */
 #include <netinet/in.h>		/* INET stuff */
@@ -15,6 +14,7 @@
 #include "net-const.h"
 #include "req.h"
 #include "parse.h"
+#include "log.h"
 
 
 static void udp_mini_reply(struct req_info *req, uint32_t reply);
@@ -49,7 +49,7 @@ static void rep_send_error(const struct req_info *req, const unsigned int code)
 	r = sendto(req->fd, minibuf, 3 * 4, 0, req->clisa, req->clilen);
 
 	if (r < 0) {
-		perror("rep_send_error() failed");
+		errlog("rep_send_error() failed");
 	}
 }