From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 2516B1582EF for ; Sun, 09 Mar 2025 18:27:24 +0000 (UTC) Received: from lists.gentoo.org (bobolink.gentoo.org [140.211.166.189]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: relay-lists.gentoo.org@gentoo.org) by smtp.gentoo.org (Postfix) with ESMTPSA id 0A6663430C4 for ; Sun, 09 Mar 2025 18:27:24 +0000 (UTC) Received: from bobolink.gentoo.org (localhost [127.0.0.1]) by bobolink.gentoo.org (Postfix) with ESMTP id EFBD4110370; Sun, 09 Mar 2025 18:27:22 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bobolink.gentoo.org (Postfix) with ESMTPS id E5882110370 for ; Sun, 09 Mar 2025 18:27:22 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 985EF3430C4 for ; Sun, 09 Mar 2025 18:27:22 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 30A6A129F for ; Sun, 09 Mar 2025 18:27:21 +0000 (UTC) From: "Mike Gilbert" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Mike Gilbert" Message-ID: <1741544532.703ec985801ed9e6886f8538cddc67a71e6cbda5.floppym@gentoo> Subject: [gentoo-commits] proj/sandbox:master commit in: libsandbox/, libsbutil/, src/ X-VCS-Repository: proj/sandbox X-VCS-Files: libsandbox/libsandbox.c libsbutil/sb_close.c libsbutil/sb_write_fd.c libsbutil/sbutil.h src/sandbox.c X-VCS-Directories: libsbutil/ libsandbox/ src/ X-VCS-Committer: floppym X-VCS-Committer-Name: Mike Gilbert X-VCS-Revision: 703ec985801ed9e6886f8538cddc67a71e6cbda5 X-VCS-Branch: master Date: Sun, 09 Mar 2025 18:27:21 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 5b01e42b-5860-47ce-af6d-cd5f2246420c X-Archives-Hash: b13a1e46e412b4049817db25d5a65435 commit: 703ec985801ed9e6886f8538cddc67a71e6cbda5 Author: Mike Gilbert gentoo org> AuthorDate: Sun Mar 9 04:52:42 2025 +0000 Commit: Mike Gilbert gentoo org> CommitDate: Sun Mar 9 18:22:12 2025 +0000 URL: https://gitweb.gentoo.org/proj/sandbox.git/commit/?id=703ec985 libsbutil: remove sb_close The close(2) manpage advises us to NOT retry after it fails. Signed-off-by: Mike Gilbert gentoo.org> libsandbox/libsandbox.c | 2 +- libsbutil/sb_close.c | 20 -------------------- libsbutil/sb_write_fd.c | 2 +- libsbutil/sbutil.h | 1 - src/sandbox.c | 2 +- 5 files changed, 3 insertions(+), 24 deletions(-) diff --git a/libsandbox/libsandbox.c b/libsandbox/libsandbox.c index 9233c6c..11c6a6c 100644 --- a/libsandbox/libsandbox.c +++ b/libsandbox/libsandbox.c @@ -178,7 +178,7 @@ static bool write_logfile(const char *logfile, const char *func, const char *pat ret = true; error: - sb_close(logfd); + close(logfd); return ret; } diff --git a/libsbutil/sb_close.c b/libsbutil/sb_close.c index 5379197..5f7def7 100644 --- a/libsbutil/sb_close.c +++ b/libsbutil/sb_close.c @@ -10,26 +10,6 @@ #include "headers.h" #include "sbutil.h" -/* General purpose function to _reliably_ close a file - * - * Returns 0 if successful or negative number on error (and errno set) - */ - -int sb_close(int fd) -{ - int res; - - do { - res = close(fd); - } while ((res < 0) && (EINTR == errno)); - - /* Do not care about errors here */ - if (-1 != res) - errno = 0; - - return res; -} - /* Quickly close all the open fds (good for daemonization) */ void sb_close_all_fds(void) { diff --git a/libsbutil/sb_write_fd.c b/libsbutil/sb_write_fd.c index fdcd34e..85eac13 100644 --- a/libsbutil/sb_write_fd.c +++ b/libsbutil/sb_write_fd.c @@ -35,6 +35,6 @@ int sb_copy_file_to_fd(const char *file, int ofd) ret = 0; error: - sb_close(ifd); + close(ifd); return ret; } diff --git a/libsbutil/sbutil.h b/libsbutil/sbutil.h index 2be3ca5..d092868 100644 --- a/libsbutil/sbutil.h +++ b/libsbutil/sbutil.h @@ -107,7 +107,6 @@ extern const char sbio_fallback_path[]; int sb_open(const char *path, int flags, mode_t mode); size_t sb_read(int fd, void *buf, size_t count); size_t sb_write(int fd, const void *buf, size_t count); -int sb_close(int fd); void sb_close_all_fds(void); int sb_copy_file_to_fd(const char *file, int ofd); int sb_exists(int dirfd, const char *pathname, int flags); diff --git a/src/sandbox.c b/src/sandbox.c index 81c7ac9..4124e86 100644 --- a/src/sandbox.c +++ b/src/sandbox.c @@ -127,7 +127,7 @@ static void print_sandbox_log(char *sandbox_log) break; sb_eerror("\n%s", buffer); } - sb_close(sandbox_log_file); + close(sandbox_log_file); sb_eerror("--------------------------------------------------------------------------------\n"); }