diff options
Diffstat (limited to 'src/socket.c')
-rw-r--r-- | src/socket.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/socket.c b/src/socket.c index f662c558e2..7ed9c3afac 100644 --- a/src/socket.c +++ b/src/socket.c @@ -362,6 +362,9 @@ const char *port_to_service(const char *sport, const char *proto) unsigned int port; struct servent *sr; + if (!c_isdigit(sport[0])) + return sport; + port = atoi(sport); if (port == 0) return sport; @@ -371,7 +374,7 @@ const char *port_to_service(const char *sport, const char *proto) sr = getservbyport(port, proto); if (sr == NULL) { fprintf(stderr, - "Warning: getservbyport() failed. Using port number as service.\n"); + "Warning: getservbyport(%s) failed. Using port number as service.\n", sport); return sport; } |