diff options
author | Felix Fietkau <nbd@openwrt.org> | 2014-10-25 16:48:45 +0000 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2014-10-25 16:48:45 +0000 |
commit | 3c9fcd2526e8a25a618851453ceb6a63e83c53b3 (patch) | |
tree | b62342b3ba0a466b7104ec1e2d76352c122223f2 /package/network/services/hostapd/patches/002-Add-os_exec-helper-to-run-external-programs.patch | |
parent | 78bd998e49120d309ddfce88de4b2df42bee2646 (diff) | |
download | upstream-3c9fcd2526e8a25a618851453ceb6a63e83c53b3.tar.gz upstream-3c9fcd2526e8a25a618851453ceb6a63e83c53b3.tar.bz2 upstream-3c9fcd2526e8a25a618851453ceb6a63e83c53b3.zip |
hostapd: update to 2014-10-25
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
SVN-Revision: 43059
Diffstat (limited to 'package/network/services/hostapd/patches/002-Add-os_exec-helper-to-run-external-programs.patch')
-rw-r--r-- | package/network/services/hostapd/patches/002-Add-os_exec-helper-to-run-external-programs.patch | 110 |
1 files changed, 0 insertions, 110 deletions
diff --git a/package/network/services/hostapd/patches/002-Add-os_exec-helper-to-run-external-programs.patch b/package/network/services/hostapd/patches/002-Add-os_exec-helper-to-run-external-programs.patch deleted file mode 100644 index c1db046410..0000000000 --- a/package/network/services/hostapd/patches/002-Add-os_exec-helper-to-run-external-programs.patch +++ /dev/null @@ -1,110 +0,0 @@ -From 89de07a9442072f88d49869d8ecd8d42bae050a0 Mon Sep 17 00:00:00 2001 -From: Jouni Malinen <jouni@qca.qualcomm.com> -Date: Mon, 6 Oct 2014 16:27:44 +0300 -Subject: [PATCH 1/3] Add os_exec() helper to run external programs - -Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com> ---- - src/utils/os.h | 9 +++++++++ - src/utils/os_unix.c | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++++ - src/utils/os_win32.c | 6 ++++++ - 3 files changed, 70 insertions(+) - ---- a/src/utils/os.h -+++ b/src/utils/os.h -@@ -584,6 +584,15 @@ static inline void os_remove_in_array(vo - */ - size_t os_strlcpy(char *dest, const char *src, size_t siz); - -+/** -+ * os_exec - Execute an external program -+ * @program: Path to the program -+ * @arg: Command line argument string -+ * @wait_completion: Whether to wait until the program execution completes -+ * Returns: 0 on success, -1 on error -+ */ -+int os_exec(const char *program, const char *arg, int wait_completion); -+ - - #ifdef OS_REJECT_C_LIB_FUNCTIONS - #define malloc OS_DO_NOT_USE_malloc ---- a/src/utils/os_unix.c -+++ b/src/utils/os_unix.c -@@ -9,6 +9,7 @@ - #include "includes.h" - - #include <time.h> -+#include <sys/wait.h> - - #ifdef ANDROID - #include <sys/capability.h> -@@ -540,3 +541,57 @@ char * os_strdup(const char *s) - } - - #endif /* WPA_TRACE */ -+ -+ -+int os_exec(const char *program, const char *arg, int wait_completion) -+{ -+ pid_t pid; -+ int pid_status; -+ -+ pid = fork(); -+ if (pid < 0) { -+ perror("fork"); -+ return -1; -+ } -+ -+ if (pid == 0) { -+ /* run the external command in the child process */ -+ const int MAX_ARG = 30; -+ char *_program, *_arg, *pos; -+ char *argv[MAX_ARG + 1]; -+ int i; -+ -+ _program = os_strdup(program); -+ _arg = os_strdup(arg); -+ -+ argv[0] = _program; -+ -+ i = 1; -+ pos = _arg; -+ while (i < MAX_ARG && pos && *pos) { -+ while (*pos == ' ') -+ pos++; -+ if (*pos == '\0') -+ break; -+ argv[i++] = pos; -+ pos = os_strchr(pos, ' '); -+ if (pos) -+ *pos++ = '\0'; -+ } -+ argv[i] = NULL; -+ -+ execv(program, argv); -+ perror("execv"); -+ os_free(_program); -+ os_free(_arg); -+ exit(0); -+ return -1; -+ } -+ -+ if (wait_completion) { -+ /* wait for the child process to complete in the parent */ -+ waitpid(pid, &pid_status, 0); -+ } -+ -+ return 0; -+} ---- a/src/utils/os_win32.c -+++ b/src/utils/os_win32.c -@@ -244,3 +244,9 @@ size_t os_strlcpy(char *dest, const char - - return s - src - 1; - } -+ -+ -+int os_exec(const char *program, const char *arg, int wait_completion) -+{ -+ return -1; -+} |