]> granicus.if.org Git - strace/blobdiff - sock.c
tests: add a test for -yy option
[strace] / sock.c
diff --git a/sock.c b/sock.c
index 89fc1ccf4b7a2c503c91d8030d872bea72b3d4b3..dca9bfd4713a45857c1391e011bc90d1bdfefaf4 100644 (file)
--- a/sock.c
+++ b/sock.c
  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- *     $Id$
  */
 
 #include "defs.h"
-
 #include <sys/socket.h>
 #include <linux/sockios.h>
 #include <arpa/inet.h>
-
-#if defined (ALPHA) || defined(SH) || defined(SH64)
-#ifdef HAVE_SYS_IOCTL_H
-#include <sys/ioctl.h>
-#elif defined(HAVE_IOCTLS_H)
-#include <ioctls.h>
-#endif
+#if defined(ALPHA) || defined(SH) || defined(SH64)
+# if defined(HAVE_SYS_IOCTL_H)
+#  include <sys/ioctl.h>
+# elif defined(HAVE_IOCTLS_H)
+#  include <ioctls.h>
+# endif
 #endif
 #include <net/if.h>
 
-static const struct xlat iffflags[] = {
-       { IFF_UP,               "IFF_UP"                },
-       { IFF_BROADCAST,        "IFF_BROADCAST"         },
-       { IFF_DEBUG,            "IFF_DEBUG"             },
-       { IFF_LOOPBACK,         "IFF_LOOPBACK"          },
-       { IFF_POINTOPOINT,      "IFF_POINTOPOINT"       },
-       { IFF_NOTRAILERS,       "IFF_NOTRAILERS"        },
-       { IFF_RUNNING,          "IFF_RUNNING"           },
-       { IFF_NOARP,            "IFF_NOARP"             },
-       { IFF_PROMISC,          "IFF_PROMISC"           },
-       { IFF_ALLMULTI,         "IFF_ALLMULTI"          },
-       { IFF_MASTER,           "IFF_MASTER"            },
-       { IFF_SLAVE,            "IFF_SLAVE"             },
-       { IFF_MULTICAST,        "IFF_MULTICAST"         },
-       { IFF_PORTSEL,          "IFF_PORTSEL"           },
-       { IFF_AUTOMEDIA,        "IFF_AUTOMEDIA"         },
-       { 0,                    NULL                    }
-};
-
+#include "xlat/iffflags.h"
 
 static void
 print_addr(struct tcb *tcp, long addr, struct ifreq *ifr)
@@ -246,8 +224,8 @@ sock_ioctl(struct tcb *tcp, long code, long arg)
                } else if (ifc.ifc_buf == NULL) {
                        tprints("NULL");
                } else {
-                       int i;
-                       unsigned nifra = ifc.ifc_len / sizeof(struct ifreq);
+                       unsigned int i;
+                       unsigned int nifra = ifc.ifc_len / sizeof(struct ifreq);
                        struct ifreq ifra[nifra];
 
                        if (umoven(tcp, (unsigned long) ifc.ifc_buf,