[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/work/kdepim-3.5.5+/kpilot/lib
From:       Jason vanRijn Kasper <vR () movingparts ! net>
Date:       2007-03-07 7:35:14
Message-ID: 1173252914.835660.16478.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 640166 by vanrijn:

- stopping leak of sockets, hopefully...


 M  +7 -2      branches/work/kdepim-3.5.5+/kpilot/lib/kpilotdevicelink.cc  


--- branches/work/kdepim-3.5.5+/kpilot/lib/kpilotdevicelink.cc #640165:640166
@@ -474,9 +474,10 @@
 	if (link()->fWorkaroundUSB)
 		timeout=10;
 
-	fPilotSocket = pi_accept_to(fPilotSocket, 0, 0, timeout);
+	int sd;
+	sd = pi_accept_to(fPilotSocket, 0, 0, timeout);
 
-	if (fPilotSocket < 0)
+	if (sd < 0)
 	{
 		char *s = strerror(errno);
 
@@ -492,6 +493,10 @@
 
 	DEBUGKPILOT << fname << ": Link accept done." << endl;
 
+	// make sure we close old socket so we don't leak...
+	pi_close(fPilotSocket);
+	fPilotSocket = sd;
+
 	if ((link()->fLinkStatus != DeviceOpen) || (fPilotSocket == -1))
 	{
 		link()->fLinkStatus = PilotLinkError;
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic