mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-24 15:56:49 +00:00
0a3ec87a66
Bump package to latest upstream Git HEAD which is commit dd2daf0848ed ("HE: Process HE 6 GHz band capab from associating HE STA"). Since last update there was 1238 commits done in the upstream tree with 618 files changed, 53399 insertions, 24928 deletions. I didn't bothered to rebase mesh patches as the changes seems not trivial and I don't have enough knowledge of those parts to do/test that properly, so someone else has to forward port them, ideally upstream them so we don't need to bother anymore. I've just deleted them for now: 004-mesh-use-setup-completion-callback-to-complete-mesh-.patch 005-mesh-update-ssid-frequency-as-pri-sec-channel-switch.patch 006-mesh-inform-kernel-driver-DFS-handler-in-userspace.patch 007-mesh-apply-channel-attributes-before-running-Mesh.patch 011-mesh-Allow-DFS-channels-to-be-selected-if-dfs-is-ena.patch 013-mesh-do-not-allow-pri-sec-channel-switch.patch 015-mesh-do-not-use-offchan-mgmt-tx-on-DFS.patch 016-mesh-fix-channel-switch-error-during-CAC.patch 018-mesh-make-forwarding-configurable.patch Refreshed all other patches, removed upstreamed patches: 051-wpa_supplicant-fix-race-condition-in-mesh-mpm-new-pe.patch 067-0001-AP-Silently-ignore-management-frame-from-unexpected-.patch 070-driver_nl80211-fix-WMM-queue-mapping-for-regulatory-.patch 071-driver_nl80211-fix-regulatory-limits-for-wmm-cwmin-c.patch 090-wolfssl-fix-crypto_bignum_sum.patch 091-0001-wolfssl-Fix-compiler-warnings-on-size_t-printf-forma.patch 091-0002-wolfssl-Fix-crypto_bignum_rand-implementation.patch 091-0003-wolfssl-Do-not-hardcode-include-directory-in-wpa_sup.patch 800-usleep.patch Tested-by: Stefan Lippers-Hollmann <s.l-h@gmx.de> [ipq8065/NBG6817; ipq40xx/MAP-AC2200] Signed-off-by: Petr Štetiar <ynezz@true.cz>
98 lines
1.8 KiB
Diff
98 lines
1.8 KiB
Diff
--- a/src/utils/os_unix.c
|
|
+++ b/src/utils/os_unix.c
|
|
@@ -10,6 +10,7 @@
|
|
|
|
#include <time.h>
|
|
#include <sys/wait.h>
|
|
+#include <fcntl.h>
|
|
|
|
#ifdef ANDROID
|
|
#include <sys/capability.h>
|
|
@@ -188,59 +189,46 @@ int os_gmtime(os_time_t t, struct os_tm
|
|
return 0;
|
|
}
|
|
|
|
-
|
|
-#ifdef __APPLE__
|
|
-#include <fcntl.h>
|
|
-static int os_daemon(int nochdir, int noclose)
|
|
+int os_daemonize(const char *pid_file)
|
|
{
|
|
- int devnull;
|
|
+ int pid = 0, i, devnull;
|
|
|
|
- if (chdir("/") < 0)
|
|
- return -1;
|
|
+#if defined(__uClinux__) || defined(__sun__)
|
|
+ return -1;
|
|
+#else /* defined(__uClinux__) || defined(__sun__) */
|
|
|
|
- devnull = open("/dev/null", O_RDWR);
|
|
- if (devnull < 0)
|
|
+#ifndef __APPLE__
|
|
+ pid = fork();
|
|
+ if (pid < 0)
|
|
return -1;
|
|
+#endif
|
|
|
|
- if (dup2(devnull, STDIN_FILENO) < 0) {
|
|
- close(devnull);
|
|
- return -1;
|
|
+ if (pid > 0) {
|
|
+ if (pid_file) {
|
|
+ FILE *f = fopen(pid_file, "w");
|
|
+ if (f) {
|
|
+ fprintf(f, "%u\n", pid);
|
|
+ fclose(f);
|
|
+ }
|
|
+ }
|
|
+ _exit(0);
|
|
}
|
|
|
|
- if (dup2(devnull, STDOUT_FILENO) < 0) {
|
|
- close(devnull);
|
|
+ if (setsid() < 0)
|
|
return -1;
|
|
- }
|
|
|
|
- if (dup2(devnull, STDERR_FILENO) < 0) {
|
|
- close(devnull);
|
|
+ if (chdir("/") < 0)
|
|
return -1;
|
|
- }
|
|
-
|
|
- return 0;
|
|
-}
|
|
-#else /* __APPLE__ */
|
|
-#define os_daemon daemon
|
|
-#endif /* __APPLE__ */
|
|
|
|
-
|
|
-int os_daemonize(const char *pid_file)
|
|
-{
|
|
-#if defined(__uClinux__) || defined(__sun__)
|
|
- return -1;
|
|
-#else /* defined(__uClinux__) || defined(__sun__) */
|
|
- if (os_daemon(0, 0)) {
|
|
- perror("daemon");
|
|
+ devnull = open("/dev/null", O_RDWR);
|
|
+ if (devnull < 0)
|
|
return -1;
|
|
- }
|
|
|
|
- if (pid_file) {
|
|
- FILE *f = fopen(pid_file, "w");
|
|
- if (f) {
|
|
- fprintf(f, "%u\n", getpid());
|
|
- fclose(f);
|
|
- }
|
|
- }
|
|
+ for (i = 0; i <= STDERR_FILENO; i++)
|
|
+ dup2(devnull, i);
|
|
+
|
|
+ if (devnull > 2)
|
|
+ close(devnull);
|
|
|
|
return -0;
|
|
#endif /* defined(__uClinux__) || defined(__sun__) */
|