bug-gnats
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Patch to fix non-numeric port numbers


From: Ben Elliston
Subject: Patch to fix non-numeric port numbers
Date: Fri, 27 Jun 2003 12:03:43 +1000
User-agent: Mutt/1.4.1i

Hi

The following patch fixes query-pr when using a $GNATSDB with a
service name (like "support") instead of a numeric port number.  I
don't have commit access to the GNATS CVS repository, so a maintainer
will need to commit it for me.

2003-06-27  Ben Elliston  <bje@wasabisystems.com>

        * client.c (scanEnv): Translate service names to port numbers in
        all cases.

Index: client.c
===================================================================
RCS file: /cvsroot/gnats/gnats/client.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 client.c
--- client.c    1 Dec 2002 03:14:58 -0000       1.1.1.1
+++ client.c    27 Jun 2003 02:02:17 -0000
@@ -852,7 +852,14 @@
 
       if (*port == -1 && vals[1][0] != '\0')
        {
-         *port = atoi (vals[1]);
+         if (isdigit ((int) (vals[1][0])))
+           *port = atoi (vals[1]);
+         else 
+           {
+             struct servent *s = getservbyname (vals[1], "tcp");
+             if (s != NULL)
+               *port = ntohs (s->s_port);
+           }
        }
 
       free (vals[1]);







reply via email to

[Prev in Thread] Current Thread [Next in Thread]