Merge pull request #9519 from neheb/libre

libreswan: Replace usleep with nanosleep
This commit is contained in:
Rosen Penev 2019-07-20 09:58:38 -07:00 committed by GitHub
commit b1a3042b9e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 1 deletions

View File

@ -14,8 +14,10 @@ PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://download.libreswan.org/
PKG_HASH:=d60e4160f43272b6307b697a13f79f56b5ec2bca61d83097ddadd8586a58ab3e
PKG_LICENSE:=GPL-2.0
PKG_MAINTAINER:=Lucian Cristian <lucian.cristian@gmail.com>
PKG_LICENSE:=GPL-2.0-or-later
PKG_LICENSE_FILES:=COPYING LICENSE
PKG_CPE_ID:=cpe:/a:libreswan:libreswan
PKG_BUILD_PARALLEL:=1
PKG_INSTALL:=1

View File

@ -0,0 +1,21 @@
--- a/programs/pluto/send.c
+++ b/programs/pluto/send.c
@@ -26,7 +26,7 @@
*
*/
-#include <unistd.h> /* for usleep() */
+#include <time.h> /* for nanosleep() */
#include <errno.h>
#include "defs.h"
@@ -173,7 +173,8 @@ bool send_chunks(const char *where, bool just_a_keepalive,
/* Send a duplicate packet when this impair is enabled - used for testing */
if (IMPAIR(JACOB_TWO_TWO)) {
/* sleep for half a second, and second another packet */
- usleep(500000);
+ const struct timespec req = {0, 500 * 1000 * 1000};
+ nanosleep(&req, NULL);
ip_endpoint_buf b;
DBG_log("JACOB 2-2: resending %zu bytes for %s through %s:%d to %s:",