[PATCH 08/10] wpa_supplicant: Fix getopt.

Christian Mauderer christian.mauderer at embedded-brains.de
Wed Nov 8 12:33:07 UTC 2017


From: Christian Mauderer <Christian.Mauderer at embedded-brains.de>

---
 freebsd/contrib/wpa/wpa_supplicant/main.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/freebsd/contrib/wpa/wpa_supplicant/main.c b/freebsd/contrib/wpa/wpa_supplicant/main.c
index 77d6a5bb535..e1c13df322a 100644
--- a/freebsd/contrib/wpa/wpa_supplicant/main.c
+++ b/freebsd/contrib/wpa/wpa_supplicant/main.c
@@ -20,6 +20,8 @@
 #include "p2p_supplicant.h"
 
 #ifdef __rtems__
+#define __need_getopt_newlib
+#include <getopt.h>
 #include <assert.h>
 #include <sys/mutex.h>
 #include <machine/rtems-bsd-program.h>
@@ -187,6 +189,15 @@ int main(int argc, char *argv[])
 	int iface_count, exitcode = -1;
 	struct wpa_params params;
 	struct wpa_global *global;
+#ifdef __rtems__
+	struct getopt_data getopt_data;
+	memset(&getopt_data, 0, sizeof(getopt_data));
+#define optind getopt_data.optind
+#define optarg getopt_data.optarg
+#define opterr getopt_data.opterr
+#define optopt getopt_data.optopt
+#define getopt(argc, argv, opt) getopt_r(argc, argv, "+" opt, &getopt_data)
+#endif /* __rtems__ */
 
 	if (os_program_init())
 		return -1;
-- 
2.12.3



More information about the devel mailing list