1
2011-02-22 Samuel Thibault <samuel.thibault@ens-lyon.org>
3
Fix __if_freereq crash: Unlike the generic version which uses free, Hurd
6
* sysdeps/mach/hurd/ifreq.h: New file.
9
ifreq.h | 45 +++++++++++++++++++++++++++++++++++++++++++++
10
1 file changed, 45 insertions(+)
11
diff --git a/sysdeps/mach/hurd/ifreq.h b/sysdeps/mach/hurd/ifreq.h
13
index 0000000..99a6b94
15
+++ b/sysdeps/mach/hurd/ifreq.h
17
+/* Copyright (C) 1999, 2002, 2003, 2011 Free Software Foundation, Inc.
18
+ This file is part of the GNU C Library.
19
+ Contributed by Andreas Jaeger <aj@suse.de>.
21
+ The GNU C Library is free software; you can redistribute it and/or
22
+ modify it under the terms of the GNU Lesser General Public
23
+ License as published by the Free Software Foundation; either
24
+ version 2.1 of the License, or (at your option) any later version.
26
+ The GNU C Library is distributed in the hope that it will be useful,
27
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
28
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
29
+ Lesser General Public License for more details.
31
+ You should have received a copy of the GNU Lesser General Public
32
+ License along with the GNU C Library; if not, write to the Free
33
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
40
+#include <sys/socket.h>
41
+#include <sys/ioctl.h>
42
+#include <sys/mman.h>
44
+static inline struct ifreq *
45
+__if_nextreq (struct ifreq *ifr)
48
+ if (ifr->ifr_addr.sa_len > sizeof ifr->ifr_addr)
49
+ return (struct ifreq *) ((char *) &ifr->ifr_addr + ifr->ifr_addr.sa_len);
54
+extern void __ifreq (struct ifreq **ifreqs, int *num_ifs, int sockfd);
58
+__if_freereq (struct ifreq *ifreqs, int num_ifs)
60
+ munmap (ifreqs, num_ifs * sizeof (struct ifreq));