1
0

Accepting request 641409 from home:kbabioch:branches:hardware

Updated patches with some feedback from upstream

OBS-URL: https://build.opensuse.org/request/show/641409
OBS-URL: https://build.opensuse.org/package/show/hardware/wpa_supplicant?expand=0&rev=85
This commit is contained in:
Karol Babioch 2018-10-12 08:28:01 +00:00 committed by Git OBS Bridge
parent ce6e50550e
commit 4a7dfdf397
2 changed files with 17 additions and 23 deletions

View File

@ -1,9 +1,7 @@
From 1c7db928d6e7bbe3e1ffa029b1ce28e65ab53e8a Mon Sep 17 00:00:00 2001
In-Reply-To: <20181011202010.29226-2-karol@babioch.de>
References: <20181011202010.29226-2-karol@babioch.de>
From a386bc4950e02975ba9a21a5be82e91a53ec9281 Mon Sep 17 00:00:00 2001
From: Karol Babioch <karol@babioch.de>
Date: Thu, 11 Oct 2018 21:22:03 +0200
Subject: [PATCH v2 2/2] Enable the close-on-exec flag for the debug log file
Subject: [PATCH v3 2/2] Enable the close-on-exec flag for the debug log file
descriptor
On Linux this flag will make sure that no file descriptor is accidentally
@ -13,11 +11,11 @@ descriptors on the Linux.
Signed-off-by: Karol Babioch <karol@babioch.de>
---
src/utils/wpa_debug.c | 11 +++++++++++
1 file changed, 11 insertions(+)
src/utils/wpa_debug.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/src/utils/wpa_debug.c b/src/utils/wpa_debug.c
index b412f88e3..9d159632d 100644
index 5d2f7becb..12873737c 100644
--- a/src/utils/wpa_debug.c
+++ b/src/utils/wpa_debug.c
@@ -60,6 +60,9 @@ static int wpa_to_android_level(int level)
@ -28,12 +26,13 @@ index b412f88e3..9d159632d 100644
+#include <fcntl.h>
+#endif /* __linux__ */
static int out_fd = -1;
static FILE *out_file = NULL;
@@ -567,6 +570,12 @@ int wpa_debug_open_file(const char *path)
#endif /* CONFIG_DEBUG_FILE */
@@ -566,6 +569,13 @@ int wpa_debug_open_file(const char *path)
close(out_fd);
return -1;
}
+
+#ifdef __linux__
+ if (fcntl(out_fd, F_SETFD, FD_CLOEXEC) == -1) {
+ wpa_printf(MSG_ERROR, "wpa_debug_open_file: Failed to set O_CLOEXEC "

View File

@ -1,9 +1,7 @@
From e0e2be52057628965a4bcce2900913bc82ed011e Mon Sep 17 00:00:00 2001
In-Reply-To: <20181011202010.29226-2-karol@babioch.de>
References: <20181011202010.29226-2-karol@babioch.de>
From 2fb45cd0370f1bc6d452df15dc1f7bf6575ed55c Mon Sep 17 00:00:00 2001
From: Karol Babioch <karol@babioch.de>
Date: Thu, 11 Oct 2018 21:21:30 +0200
Subject: [PATCH v2 1/2] Create debug log file with more sane file permissions
Subject: [PATCH v3 1/2] Create debug log file with more sane file permissions
Previously the file permissions for the debug log file were not explicitly set.
Instead it was implicitly relying on a secure umask, which in most cases would
@ -28,29 +26,29 @@ existing debug log files, and only applies to newly created ones.
Signed-off-by: Karol Babioch <karol@babioch.de>
---
src/utils/wpa_debug.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
src/utils/wpa_debug.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/src/utils/wpa_debug.c b/src/utils/wpa_debug.c
index 62758d864..b412f88e3 100644
index 62758d864..5d2f7becb 100644
--- a/src/utils/wpa_debug.c
+++ b/src/utils/wpa_debug.c
@@ -58,6 +58,10 @@ static int wpa_to_android_level(int level)
@@ -58,6 +58,9 @@ static int wpa_to_android_level(int level)
#ifndef CONFIG_NO_STDOUT_DEBUG
#ifdef CONFIG_DEBUG_FILE
+#include <sys/types.h>
+#include <sys/stat.h>
+
+static int out_fd = -1;
static FILE *out_file = NULL;
#endif /* CONFIG_DEBUG_FILE */
@@ -548,12 +552,21 @@ int wpa_debug_open_file(const char *path)
@@ -548,10 +551,19 @@ int wpa_debug_open_file(const char *path)
last_path = os_strdup(path);
}
- out_file = fopen(path, "a");
+ int out_fd = -1;
+ out_fd = open(path, O_CREAT | O_APPEND, S_IRUSR | S_IWUSR | S_IRGRP);
+ if (out_fd < 0) {
+ wpa_printf(MSG_ERROR, "wpa_debug_open_file: Failed to open "
@ -65,10 +63,7 @@ index 62758d864..b412f88e3 100644
+ close(out_fd);
return -1;
}
+
#ifndef _WIN32
setvbuf(out_file, NULL, _IOLBF, 0);
#endif /* _WIN32 */
--
2.19.1