aboutsummaryrefslogtreecommitdiffstats
path: root/src/process.c
diff options
context:
space:
mode:
authorPaul Eggert2011-08-04 19:15:35 -0700
committerPaul Eggert2011-08-04 19:15:35 -0700
commit0065d05491ce5981ea20896bb26d21dcd31e6769 (patch)
tree13240167319d4a99ab5eacae4a883258eb2d28de /src/process.c
parent18ab493650d648ab8dca651ea2698861f926e895 (diff)
downloademacs-0065d05491ce5981ea20896bb26d21dcd31e6769.tar.gz
emacs-0065d05491ce5981ea20896bb26d21dcd31e6769.zip
Adjust in response to jan.h.d's comments.
See, for example <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=9196#26>.
Diffstat (limited to 'src/process.c')
-rw-r--r--src/process.c18
1 files changed, 3 insertions, 15 deletions
diff --git a/src/process.c b/src/process.c
index 31359a1f1f2..f2c2bfd81c5 100644
--- a/src/process.c
+++ b/src/process.c
@@ -3558,7 +3558,7 @@ format; see the description of ADDRESS in `make-network-process'. */)
3558{ 3558{
3559 struct ifconf ifconf; 3559 struct ifconf ifconf;
3560 struct ifreq *ifreqs = NULL; 3560 struct ifreq *ifreqs = NULL;
3561 int ifaces = 0; 3561 ptrdiff_t ifaces = 0;
3562 int buf_size, s; 3562 int buf_size, s;
3563 Lisp_Object res; 3563 Lisp_Object res;
3564 3564
@@ -3567,21 +3567,9 @@ format; see the description of ADDRESS in `make-network-process'. */)
3567 return Qnil; 3567 return Qnil;
3568 3568
3569 again: 3569 again:
3570 if (min (INT_MAX, min (PTRDIFF_MAX, SIZE_MAX)) / sizeof *ifreqs - 25 3570 ifreqs = xpalloc (ifreqs, &ifaces, 25,
3571 < ifaces) 3571 INT_MAX / sizeof *ifreqs, sizeof *ifreqs);
3572 {
3573 xfree (ifreqs);
3574 memory_full (SIZE_MAX);
3575 }
3576 ifaces += 25;
3577 buf_size = ifaces * sizeof (ifreqs[0]); 3572 buf_size = ifaces * sizeof (ifreqs[0]);
3578 ifreqs = (struct ifreq *)xrealloc(ifreqs, buf_size);
3579 if (!ifreqs)
3580 {
3581 close (s);
3582 return Qnil;
3583 }
3584
3585 ifconf.ifc_len = buf_size; 3573 ifconf.ifc_len = buf_size;
3586 ifconf.ifc_req = ifreqs; 3574 ifconf.ifc_req = ifreqs;
3587 if (ioctl (s, SIOCGIFCONF, &ifconf)) 3575 if (ioctl (s, SIOCGIFCONF, &ifconf))