$OpenBSD: patch-src_utils_net_upnp_stubs_c,v 1.3 2012/05/08 08:24:40 dcoppa Exp $

Fix build with latest libnatpmp/miniupnpc

Remove bogus call to pthread_mutex_unlock()

--- src/utils/net/upnp_stubs.c.orig	Mon Nov  1 18:19:23 2010
+++ src/utils/net/upnp_stubs.c	Tue May  8 09:24:59 2012
@@ -501,7 +501,7 @@ natpmpPulse( ml_upnpmp_t * map )
 
     if( map->enabled && ( map->natpmpState == ML_NATPMP_DISCOVER ) )
     {
-        int val = initnatpmp( &map->natpmp );
+        int val = initnatpmp( &map->natpmp, 0, 0 );
         dbg_printf( "initnatpmp = %d\n", val );
         val = sendpublicaddressrequest( &map->natpmp );
         dbg_printf( "sendpublicaddressrequest = %d\n", val );
@@ -639,7 +639,7 @@ upnpPulse( ml_upnpmp_t * map )
     {
         struct UPNPDev * devlist;
         errno = 0;
-        devlist = upnpDiscover( 2000, NULL, NULL, 0 );
+        devlist = upnpDiscover( 2000, NULL, NULL, 0, 0, 0 );
         if( devlist == NULL )
         {
             dbg_printf( "upnpDiscover failed (errno %d - %s)\n", errno,  str_errno( errno ) );
@@ -680,7 +680,7 @@ upnpPulse( ml_upnpmp_t * map )
         snprintf( type, sizeof( type ), "%s", ( map->isTcp ? "TCP" : "UDP" ) );
         i = UPNP_GetSpecificPortMappingEntry( map->upnpUrls.controlURL,
                                               map->upnpData.first.servicetype, portStr,
-                                              type, intClient, intPort );
+                                              type, intClient, intPort, NULL, NULL, NULL );
         if( i != UPNPCOMMAND_SUCCESS )
         {
             dbg_printf( "Port %d isn't forwarded\n", map->extPort );
@@ -730,7 +730,7 @@ upnpPulse( ml_upnpmp_t * map )
             err = UPNP_AddPortMapping( map->upnpUrls.controlURL,
                                        map->upnpData.first.servicetype,
                                        extPortStr, intPortStr, map->lanaddr,
-                                       desc, type, NULL );
+                                       desc, type, NULL, "0" );
             map->upnpMapped = !err;
         }
         dbg_printf( "Port forwarding through \"%s\", service \"%s\". (local address[%s:%d])\n", map->upnpUrls.controlURL, map->upnpData.first.servicetype, map->lanaddr, map->intPort );
@@ -901,7 +901,6 @@ upnp_thread_start( )
 	    //pthread_cond_init(&cond, NULL);
 	    pthread_mutex_init(&g_mutex, NULL);
 	    pthread_mutex_init(&g_delay_mutex, NULL);
-	    pthread_mutex_unlock(&g_mutex);
 
 	    err = pthread_create(&g_pthread, &attr, upnpNatpmpThread, NULL);
 
