small patches

"Nuno Ferreira" <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Organization Graycell
Message-ID <[email protected]>
Hi,
while trying to understand kannel sources and doing some tests I 
found some small problems, here is the patch.
Note that I didn't see any real problem happening, those are just
potential errors.
Also, I had a situation where smsbox wouldn't die, after I tried killing
it just entered an infinite loop doing pool (verified with strace). Is
it a known problem?
 
Anyway, here's the ChangeLog
2003-05-07  Nuno Ferreira  <[email protected]>
    * gwlib/gwthread-pthread.c (gwthread_pollfd): initialize revents to 0,
      otherwise an initialized value can be read when the wait times out.
    * gw/bb_boxc.c: add forward declaration of route_incoming_sms to avoid
      compiler warning
      (boxc_sender): unlock boxc_id_mutex so that the creating thread can
      safely destroy the mutex
    * gw/smsc/smsc_emi2.c (smsc_emi2_create): initialize check_time

Any comments?

--
Nuno Ferreira
graycell - Consultoria e Sistemas de Informação Lda.
misc.patch (application/octet-stream, 2.8 KB)
Index: ChangeLog
===================================================================
RCS file: /home/cvs/gateway/ChangeLog,v
retrieving revision 1.2143
diff -u -r1.2143 ChangeLog
--- ChangeLog	4 May 2003 18:59:16 -0000	1.2143
+++ ChangeLog	7 May 2003 13:24:22 -0000
@@ -1,3 +1,12 @@
+2003-05-07  Nuno Ferreira  <[email protected]>
+    * gwlib/gwthread-pthread.c (gwthread_pollfd): initialize revents to 0,
+      otherwise an initialized value can be read when the wait times out.
+    * gw/bb_boxc.c: add forward declaration of route_incoming_sms to avoid
+      compiler warning
+      (boxc_sender): unlock boxc_id_mutex so that the creating thread can
+      safely destroy the mutex
+    * gw/smsc/smsc_emi2.c (smsc_emi2_create): initialize check_time
+
 2003-05-04  Bruno Rodrigues  <[email protected]> 
     * debian/*.init: fix bug (Closes: #25)
 
Index: gw/bb_boxc.c
===================================================================
RCS file: /home/cvs/gateway/gw/bb_boxc.c,v
retrieving revision 1.65
diff -u -r1.65 bb_boxc.c
--- gw/bb_boxc.c	27 Mar 2003 08:55:01 -0000	1.65
+++ gw/bb_boxc.c	7 May 2003 13:24:25 -0000
@@ -35,6 +35,7 @@
 extern List *flow_threads;
 extern List *suspended;
 
+void route_incoming_sms(Msg *msg);
 /* our own thingies */
 
 static volatile sig_atomic_t smsbox_running;
@@ -336,6 +337,7 @@
     /* the client closes the connection, after that die in receiver */
     /* conn->alive = 0; */
 
+    mutex_unlock(conn->boxc_id_mutex);
     list_remove_producer(flow_threads);
 }
 
Index: gw/smsc/smsc_emi2.c
===================================================================
RCS file: /home/cvs/gateway/gw/smsc/smsc_emi2.c,v
retrieving revision 1.16
diff -u -r1.16 smsc_emi2.c
--- gw/smsc/smsc_emi2.c	29 Apr 2003 12:18:26 -0000	1.16
+++ gw/smsc/smsc_emi2.c	7 May 2003 13:24:30 -0000
@@ -1213,7 +1213,7 @@
 	timeouttime = emi2_get_timeouttime (conn, *server);
 	
 	event = emi2_wait (conn, *server, timeouttime);
-	
+
 	switch (event) {
 	case EMI2_CONNERR:
 	    return;
@@ -1539,6 +1539,7 @@
     privdata->can_write = 1;
     privdata->priv_nexttrn = 0;
     privdata->last_activity_time = 0;
+    privdata->check_time = 0;
 
     
     host = cfg_get(cfg, octstr_imm("host"));
Index: gwlib/gwthread-pthread.c
===================================================================
RCS file: /home/cvs/gateway/gwlib/gwthread-pthread.c,v
retrieving revision 1.38
diff -u -r1.38 gwthread-pthread.c
--- gwlib/gwthread-pthread.c	4 Sep 2002 09:11:06 -0000	1.38
+++ gwlib/gwthread-pthread.c	7 May 2003 13:24:31 -0000
@@ -581,9 +581,11 @@
 
     pollfd[0].fd = threadinfo->wakefd_recv;
     pollfd[0].events = POLLIN;
+    pollfd[0].revents = 0;
 
     pollfd[1].fd = fd;
     pollfd[1].events = events;
+    pollfd[1].revents = 0;
 
     milliseconds = timeout * 1000;
     if (milliseconds < 0)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.