From patchwork Thu Oct 11 20:20:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Karol Babioch X-Patchwork-Id: 982697 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=babioch.de Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="urQ4xmtZ"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=babioch.de header.i=@babioch.de header.b="KNIEgbuM"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42WMnQ6lCGz9s7T for ; Fri, 12 Oct 2018 07:21:46 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=GiC1oAGGnmpDBLUbvoc55zhG30ZROcXAJg9xWHsCmB8=; b=urQ4xmtZf6ImQL o5nJn6pas7Et9bCmZVnC/x4WonC6kx5tfLutot88AI15tNlJzLoxQ8FnqL5cwwQjrzpAR9csmg274 RJ54bGeE+jckNuSzyOwr8NpYqTsl35MzaqN1qXC3rIRBwR+8pFqFSSS+63oQ8lXR4THeCIVYpTeIQ 9DbwxPzZpWW7MWWHZO6vGdUkrIRLppSWJAd6hWTO2j1Hv3ivoI/ZoceNNI1BVWkUDgsKtqgqn52Ra vRyODzEQ24d/7hP8LpCv5ogfsHu+6wd4tRY1jT6jlq8ozgPj/fkwrNj4ZKPUwk+qMCHDviXXnCnie pAMR5Apm8HXkQIWiK5lA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gAhSV-0006b6-Q1; Thu, 11 Oct 2018 20:21:23 +0000 Received: from mail.babioch.de ([144.76.131.5]) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gAhSE-0006UM-H7 for hostap@lists.infradead.org; Thu, 11 Oct 2018 20:21:08 +0000 From: Karol Babioch DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=babioch.de; s=20170501; t=1539289257; bh=Qj8mblOIueY+4NvtOxG2Ml45dakuJaTPoatg5MUrotU=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=KNIEgbuMcJtnitNt+ck96aFjpWIEQMG2KVLYAuYCancAMAZtUL8s/CFgIOlXZRsL6 3wv1iJtNDvzqoi0dxaQusHxzQkc3QMjua64e/t26IqHEU/nwRj88xavauIVaJjREv6 ZIp4taMqsOw26IGgtS90tMGOFInzpQexhezyBfasH+FlUhpky2k3IhAXrCh5t2Cnpu J4k6QE5jiw5XlevYRpmrongLepwze3Li/s2IJB8u4/O7nMWS45zv9MZI9amFF2VUhg QSgXV71bzIiH28loYwnRV+ubp9tGd4op0h4tvUluqgaX5s5DSpcY9DiHSfUOLGZhnr uQmuf0x+UQy/w== To: hostap@lists.infradead.org Subject: [PATCH 2/2] Enable the close-on-exec flag for the debug log file descriptor Date: Thu, 11 Oct 2018 22:20:10 +0200 Message-Id: <20181011202010.29226-2-karol@babioch.de> In-Reply-To: <20181011202010.29226-1-karol@babioch.de> References: <20181011202010.29226-1-karol@babioch.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181011_132106_870985_5E3B089F X-CRM114-Status: UNSURE ( 8.39 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.8 (/) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-0.8 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [144.76.131.5 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain X-BeenThere: hostap@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Karol Babioch Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org On Linux platforms this flag will make sure that file descriptor is leaked into potential child processes. While this is not a problem right now, it is considered to be good practice these days when dealing with file descriptors on the Linux platform. Signed-off-by: Karol Babioch --- src/utils/wpa_debug.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/utils/wpa_debug.c b/src/utils/wpa_debug.c index b412f88e3..9d159632d 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) #ifdef CONFIG_DEBUG_FILE #include #include +#ifdef __linux__ +#include +#endif /* __linux__ */ static int out_fd = -1; static FILE *out_file = NULL; @@ -567,6 +570,14 @@ int wpa_debug_open_file(const char *path) 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 " + "on output file descriptor, using standard output"); + close(out_fd); + return -1; + } +#endif /* __linux__ */ #ifndef _WIN32 setvbuf(out_file, NULL, _IOLBF, 0); #endif /* _WIN32 */