miniupnp.tuxfamily.org Forum Index miniupnp.tuxfamily.org
The forum about miniupnp and libnatpmp
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

upnpc exit status is 0 even on error

 
Post new topic   Reply to topic    miniupnp.tuxfamily.org Forum Index -> miniupnpc Bugs
View previous topic :: View next topic  
Author Message
RichardNeill



Joined: 28 May 2010
Posts: 2

PostPosted: Fri May 28, 2010 12:35 am    Post subject: upnpc exit status is 0 even on error Reply with quote

When I call upnpc from another script, it would be nice if it followed the normal Unix conventions, namely:
If it worked, exit 0
Otherwise, exit with an error code (anything other than 0),

However, this doesn't actually happen. For example, upnpc.c contains:

int main(...
....
fprintf(stderr, "No IGD UPnP Device found on the network !\n");
...
return 0;
}
Back to top
View user's profile Send private message
RichardNeill



Joined: 28 May 2010
Posts: 2

PostPosted: Fri May 28, 2010 1:13 am    Post subject: Also, STDERR vs STDOUT Reply with quote

In a similar vein, it would be nice if the error messages went to STDERR and the output to STDOUT.

For example, here is some output, with my comments interspersed.

upnpc : miniupnpc library test client. (c) 2006-2009 Thomas Bernard
#STDERR

Go to http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
for more information.
#STDERR

No IGD UPnP Device found on the network !
#STDOUT. With exit (1).


Or:



upnpc : miniupnpc library test client. (c) 2006-2009 Thomas Bernard
#STDERR

Go to http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
for more information.
#STDERR

List of UPNP devices found on the network :
desc: http://10.0.0.1:5000/rootDesc.xml
st: urn:schemas-upnp-org:device:InternetGatewayDevice:1
#STDOUT

Found valid IGD : http://10.0.0.1:5000/ctl/IPConn
#STDOUT

Local LAN ip address : 10.0.0.2
#STDOUT

Connection Type : IP_Routed
#STDOUT

Status : Connected, uptime=4, LastConnectionError : ERROR_NONE
#STDOUT

MaxBitRateDown : 12643000 bps MaxBitRateUp 12643000 bps
#STDOUT

ExternalIPAddress = xxx.xxx.xxx.xxx
#STDOUT

0 UDP 0->0.0.0.200:4096 'Unknown' ''
#STDOUT

GetGenericPortMappingEntry() returned 713 (SpecifiedArrayIndexInvalid)
#STDERR
Back to top
View user's profile Send private message
miniupnp
Site Admin


Joined: 14 Apr 2007
Posts: 1589

PostPosted: Wed Jun 09, 2010 11:09 am    Post subject: Re: upnpc exit status is 0 even on error Reply with quote

RichardNeill wrote:
When I call upnpc from another script, it would be nice if it followed the normal Unix conventions, namely:
If it worked, exit 0
Otherwise, exit with an error code (anything other than 0),

However, this doesn't actually happen. For example, upnpc.c contains:

int main(...
....
fprintf(stderr, "No IGD UPnP Device found on the network !\n");
...
return 0;
}

I made some modifications. Look at miniupnpc-1.4.20100609.tar.gz
_________________
Main miniUPnP author.
https://miniupnp.tuxfamily.org/
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    miniupnp.tuxfamily.org Forum Index -> miniupnpc Bugs All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP
© 2007 Thomas Bernard, author of MiniUPNP.