[rtems-libbsd commit] wpa_supplicant: Fix getopt.

Sebastian Huber sebh at rtems.org
Fri Nov 10 13:22:23 UTC 2017


Module:    rtems-libbsd
Branch:    master
Commit:    bed8742caa074c8d0933ce733cc92c448b680dc0
Changeset: http://git.rtems.org/rtems-libbsd/commit/?id=bed8742caa074c8d0933ce733cc92c448b680dc0

Author:    Christian Mauderer <Christian.Mauderer at embedded-brains.de>
Date:      Fri Nov  3 11:08:48 2017 +0100

wpa_supplicant: Fix getopt.

---

 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 77d6a5b..e1c13df 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;



More information about the vc mailing list