From 9c86e07067a8ced798e059f1d58dec2c1af82362 Mon Sep 17 00:00:00 2001 From: Alejandro Colomar Date: Fri, 2 Dec 2022 22:30:24 +0100 Subject: [PATCH] Assume fchmod(2) exists MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It is required by POSIX.1-2001. Cc: Christian Göttsche Signed-off-by: Alejandro Colomar --- configure.ac | 2 +- lib/commonio.c | 7 +------ 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/configure.ac b/configure.ac index ebb3b1b0..ae15ff8d 100644 --- a/configure.ac +++ b/configure.ac @@ -45,7 +45,7 @@ AC_CHECK_HEADERS(crypt.h utmp.h \ dnl shadow now uses the libc's shadow implementation AC_CHECK_HEADER([shadow.h],,[AC_MSG_ERROR([You need a libc with shadow.h])]) -AC_CHECK_FUNCS(arc4random_buf fchmod fchown fsync futimes \ +AC_CHECK_FUNCS(arc4random_buf fchown fsync futimes \ getentropy getrandom getspnam getusershell \ getutent initgroups lckpwdf lutimes \ setgroups updwtmp updwtmpx innetgr getpwnam_r \ diff --git a/lib/commonio.c b/lib/commonio.c index 9a02ce1a..df26c2b8 100644 --- a/lib/commonio.c +++ b/lib/commonio.c @@ -261,15 +261,10 @@ static /*@null@*/ /*@dependent@*/FILE *fopen_set_perms ( } #endif /* !HAVE_FCHOWN */ -#ifdef HAVE_FCHMOD if (fchmod (fileno (fp), sb->st_mode & 0664) != 0) { goto fail; } -#else /* !HAVE_FCHMOD */ - if (chmod (name, sb->st_mode & 0664) != 0) { - goto fail; - } -#endif /* !HAVE_FCHMOD */ + return fp; fail: