diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2011-08-18 10:01:52 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2011-08-18 10:01:52 -0700 |
commit | 76667214e7bdc7f6196de2bb6d7e14ef879a2694 (patch) | |
tree | 58ca2d3448d502ff4ac2e46aefc8b90582c4d1ab /src/process.c | |
parent | 2fab8395070ff77b836cb8ca9b84c261c4387a9a (diff) | |
parent | 92b714445aac9be4227684f9c90cd61c3a0f02d5 (diff) | |
download | emacs-76667214e7bdc7f6196de2bb6d7e14ef879a2694.tar.gz |
Merge from trunk.
Diffstat (limited to 'src/process.c')
-rw-r--r-- | src/process.c | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/src/process.c b/src/process.c index 9f3bb0e5803..08da53b4a40 100644 --- a/src/process.c +++ b/src/process.c @@ -3581,33 +3581,31 @@ format; see the description of ADDRESS in `make-network-process'. */) if (s < 0) return Qnil; - again: - - buf = xpalloc (buf, &buf_size, sizeof *ifreq, INT_MAX, 1); - ifconf.ifc_buf = buf; - ifconf.ifc_len = buf_size; - if (ioctl (s, SIOCGIFCONF, &ifconf)) + do { - close (s); - xfree (buf); - return Qnil; + buf = xpalloc (buf, &buf_size, 1, INT_MAX, 1); + ifconf.ifc_buf = buf; + ifconf.ifc_len = buf_size; + if (ioctl (s, SIOCGIFCONF, &ifconf)) + { + close (s); + xfree (buf); + return Qnil; + } } - - if (ifconf.ifc_len == buf_size) - goto again; + while (ifconf.ifc_len == buf_size); close (s); res = Qnil; - for (ifreq = ifconf.ifc_req; - (char *) ifreq < (char *) (ifconf.ifc_req) + ifconf.ifc_len; - ) + ifreq = ifconf.ifc_req; + while ((char *) ifreq < (char *) ifconf.ifc_req + ifconf.ifc_len) { struct ifreq *ifq = ifreq; #ifdef HAVE_STRUCT_IFREQ_IFR_ADDR_SA_LEN -#define SIZEOF_IFREQ(sif) \ - ((sif)->ifr_addr.sa_len < sizeof(struct sockaddr) ? \ - sizeof((*sif)) : sizeof ((sif)->ifr_name) + sif->ifr_addr.sa_len) +#define SIZEOF_IFREQ(sif) \ + ((sif)->ifr_addr.sa_len < sizeof (struct sockaddr) \ + ? sizeof (*(sif)) : sizeof ((sif)->ifr_name) + (sif)->ifr_addr.sa_len) int len = SIZEOF_IFREQ (ifq); #else @@ -3615,7 +3613,7 @@ format; see the description of ADDRESS in `make-network-process'. */) #endif char namebuf[sizeof (ifq->ifr_name) + 1]; i += len; - ifreq = (struct ifreq*) ((char*) ifreq + len); + ifreq = (struct ifreq *) ((char *) ifreq + len); if (ifq->ifr_addr.sa_family != AF_INET) continue; |