]> granicus.if.org Git - transmission/commitdiff
(libT) #5293 'Wrong error codes used in upnp.c': second patch from rb07 to handle...
authorJordan Lee <jordan@transmissionbt.com>
Mon, 18 Feb 2013 00:36:20 +0000 (00:36 +0000)
committerJordan Lee <jordan@transmissionbt.com>
Mon, 18 Feb 2013 00:36:20 +0000 (00:36 +0000)
libtransmission/upnp.c

index 0e92679b39d7729c7958a677d1c8b654303ec470..fb775d065e8cab2eabc21ce5d3e87260245bcf13 100644 (file)
@@ -91,17 +91,16 @@ static struct UPNPDev *
 tr_upnpDiscover (int msec)
 {
     struct UPNPDev * ret = NULL;
-    int err = UPNPDISCOVER_SUCCESS;
 
 #if defined (HAVE_MINIUPNP_16)
+    int err = UPNPDISCOVER_SUCCESS;
     ret = upnpDiscover (msec, NULL, NULL, 0, 0, &err);
+    if (err != UPNPDISCOVER_SUCCESS)
 #elif defined (HAVE_MINIUPNP_15)
     ret = upnpDiscover (msec, NULL, NULL, 0);
-#else
-    ret = UPNPDISCOVER_UNKNOWN_ERROR;
+    if (ret == NULL)
 #endif
 
-    if (err != UPNPDISCOVER_SUCCESS)
         tr_logAddNamedDbg (getKey (), "upnpDiscover failed (errno %d - %s)", errno, tr_strerror (errno));
 
     return ret;