aboutsummaryrefslogtreecommitdiffstats
path: root/src/process.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/process.c')
-rw-r--r--src/process.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/process.c b/src/process.c
index 8c88e62ee05..62a26c381b9 100644
--- a/src/process.c
+++ b/src/process.c
@@ -3428,6 +3428,17 @@ conv_numerical_to_lisp (unsigned char *number, int length, int port)
3428} 3428}
3429#endif 3429#endif
3430 3430
3431/* Return true if STRING consists only of numerical characters. */
3432static bool
3433string_integer_p (Lisp_Object string)
3434{
3435 char *s = SSDATA (string), c;
3436 while ((c = *s++))
3437 if (c < '0' || c > '9')
3438 return false;
3439 return true;
3440}
3441
3431/* Create a network stream/datagram client/server process. Treated 3442/* Create a network stream/datagram client/server process. Treated
3432 exactly like a normal process when reading and writing. Primary 3443 exactly like a normal process when reading and writing. Primary
3433 differences are in status display and process deletion. A network 3444 differences are in status display and process deletion. A network
@@ -3852,6 +3863,10 @@ usage: (make-network-process &rest ARGS) */)
3852 port = 0; 3863 port = 0;
3853 else if (INTEGERP (service)) 3864 else if (INTEGERP (service))
3854 port = (unsigned short) XINT (service); 3865 port = (unsigned short) XINT (service);
3866 /* Allow the service to be a string containing the port number,
3867 because that's allowed if you have getaddrbyname. */
3868 else if (string_integer_p (service))
3869 port = strtol (SSDATA (service), NULL, 10);
3855 else 3870 else
3856 { 3871 {
3857 struct servent *svc_info; 3872 struct servent *svc_info;