From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/13990 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Drew DeVault Newsgroups: gmane.linux.lib.musl.general Subject: [PATCH 2/3] stdio/rename: use renameat2 when appropriate Date: Thu, 21 Mar 2019 11:32:39 -0400 Message-ID: <20190321153240.29328-3-sir@cmpwn.com> References: <20190321153240.29328-1-sir@cmpwn.com> Reply-To: musl@lists.openwall.com Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="70420"; mail-complaints-to="usenet@blaine.gmane.org" Cc: Drew DeVault To: musl@lists.openwall.com Original-X-From: musl-return-14006-gllmg-musl=m.gmane.org@lists.openwall.com Thu Mar 21 16:33:37 2019 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.89) (envelope-from ) id 1h6zhI-000IAX-6e for gllmg-musl@m.gmane.org; Thu, 21 Mar 2019 16:33:36 +0100 Original-Received: (qmail 5643 invoked by uid 550); 21 Mar 2019 15:33:01 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 5172 invoked from network); 21 Mar 2019 15:32:55 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=cmpwn.com; s=cmpwn; t=1553182493; bh=uhcdi3onsAql3/gXoAvcb5+auxNA0k5D2L4PyjPrgzQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=bPafxAfP/7Yt38mlwsBP6xDd6oi6qpgUtuefi4QCgCEWhwa+AsB9gZkatPbkN5u9e MgV/XDvR0bpjIKu8nW4CmwnCFalVKyYggYQydGWzvuNsKQv39ZJuGseXMWgk1snVBB bbl+il34kje9ZkJlmgW7hM1x08aHWJN+vagBSudo= X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190321153240.29328-1-sir@cmpwn.com> Xref: news.gmane.org gmane.linux.lib.musl.general:13990 Archived-At: --- src/stdio/rename.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/stdio/rename.c b/src/stdio/rename.c index 04c90c01..f540adb6 100644 --- a/src/stdio/rename.c +++ b/src/stdio/rename.c @@ -4,9 +4,11 @@ int rename(const char *old, const char *new) { -#ifdef SYS_rename +#if defined(SYS_rename) return syscall(SYS_rename, old, new); -#else +#elif defined(SYS_renameat) return syscall(SYS_renameat, AT_FDCWD, old, AT_FDCWD, new); +#else + return syscall(SYS_renameat2, AT_FDCWD, old, AT_FDCWD, new, 0); #endif } -- 2.21.0