aboutsummaryrefslogtreecommitdiffstats
path: root/package/network
diff options
context:
space:
mode:
authorRosen Penev <rosenp@gmail.com>2020-04-06 19:17:59 -0700
committerHauke Mehrtens <hauke@hauke-m.de>2020-04-13 22:40:19 +0200
commit76d22fc24b4d4a7e93b722af3005cc38bdef8111 (patch)
treec2e62ddde07e8f487a775e13950e916cc56e1d7d /package/network
parentb43023b7baeae9c4702c46677be16585b715bc3e (diff)
downloadupstream-76d22fc24b4d4a7e93b722af3005cc38bdef8111.tar.gz
upstream-76d22fc24b4d4a7e93b722af3005cc38bdef8111.tar.bz2
upstream-76d22fc24b4d4a7e93b722af3005cc38bdef8111.zip
hostapd: backport usleep patch
Optionally fixes compilation with uClibc-ng. Signed-off-by: Rosen Penev <rosenp@gmail.com>
Diffstat (limited to 'package/network')
-rw-r--r--package/network/services/hostapd/Makefile2
-rw-r--r--package/network/services/hostapd/patches/800-usleep.patch53
2 files changed, 54 insertions, 1 deletions
diff --git a/package/network/services/hostapd/Makefile b/package/network/services/hostapd/Makefile
index 7472f5904e..b7fe1d8018 100644
--- a/package/network/services/hostapd/Makefile
+++ b/package/network/services/hostapd/Makefile
@@ -7,7 +7,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=hostapd
-PKG_RELEASE:=8
+PKG_RELEASE:=9
PKG_SOURCE_URL:=http://w1.fi/hostap.git
PKG_SOURCE_PROTO:=git
diff --git a/package/network/services/hostapd/patches/800-usleep.patch b/package/network/services/hostapd/patches/800-usleep.patch
new file mode 100644
index 0000000000..6d90e6f64c
--- /dev/null
+++ b/package/network/services/hostapd/patches/800-usleep.patch
@@ -0,0 +1,53 @@
+From 39042d7f7c4997af55474ebe4513c81f00732837 Mon Sep 17 00:00:00 2001
+From: Rosen Penev <rosenp@gmail.com>
+Date: Sat, 24 Aug 2019 15:01:16 -0700
+Subject: os_sleep: Use nanosleep for POSIX versions 2008 and higher
+
+uClibc-ng optionally disabled deprecated POSIX functions like usleep,
+causing compilation failures. This switches to nanosleep while retaining
+support for older libcs that do not support nanosleep.
+
+Signed-off-by: Rosen Penev <rosenp@gmail.com>
+---
+ src/utils/os_internal.c | 6 ++++++
+ src/utils/os_unix.c | 6 ++++++
+ 2 files changed, 12 insertions(+)
+
+--- a/src/utils/os_internal.c
++++ b/src/utils/os_internal.c
+@@ -25,10 +25,16 @@
+
+ void os_sleep(os_time_t sec, os_time_t usec)
+ {
++#if defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 200809L)
++ const struct timespec req = { sec, usec * 1000 };
++
++ nanosleep(&req, NULL);
++#else
+ if (sec)
+ sleep(sec);
+ if (usec)
+ usleep(usec);
++#endif
+ }
+
+
+--- a/src/utils/os_unix.c
++++ b/src/utils/os_unix.c
+@@ -50,10 +50,16 @@ struct os_alloc_trace {
+
+ void os_sleep(os_time_t sec, os_time_t usec)
+ {
++#if defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 200809L)
++ const struct timespec req = { sec, usec * 1000 };
++
++ nanosleep(&req, NULL);
++#else
+ if (sec)
+ sleep(sec);
+ if (usec)
+ usleep(usec);
++#endif
+ }
+
+