From c32e4cdde1c23911fe54034577977574b53d8957 Mon Sep 17 00:00:00 2001 From: Jordan Lee Date: Mon, 18 Feb 2013 00:36:20 +0000 Subject: [PATCH] (libT) #5293 'Wrong error codes used in upnp.c': second patch from rb07 to handle older versions of miniupnpc --- libtransmission/upnp.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/libtransmission/upnp.c b/libtransmission/upnp.c index 0e92679b3..fb775d065 100644 --- a/libtransmission/upnp.c +++ b/libtransmission/upnp.c @@ -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; -- 2.40.0