login: fix close_range() use
This new syscall comes with three arguments (see kernel commit 278a5fbaed89dacd04e9d052f4594ffd0e0585de). Not sure why util-linux assume only two. Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1981729 Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
parent
50a3c3bd28
commit
b8d99a618b
|
@ -82,9 +82,9 @@ static inline struct dirent *xreaddir(DIR *dp)
|
|||
# if defined(SYS_close_range)
|
||||
# include <sys/types.h>
|
||||
# ifndef HAVE_CLOSE_RANGE
|
||||
static inline int close_range(unsigned int first, unsigned int last)
|
||||
static inline int close_range(unsigned int first, unsigned int last, int flags)
|
||||
{
|
||||
return syscall(SYS_close_range, first, last);
|
||||
return syscall(SYS_close_range, first, last, flags);
|
||||
}
|
||||
# endif
|
||||
# define HAVE_CLOSE_RANGE 1
|
||||
|
|
|
@ -189,7 +189,7 @@ int main(int argc, char *argv[])
|
|||
ignore_result( dup(STDIN_FILENO) );
|
||||
|
||||
# ifdef HAVE_CLOSE_RANGE
|
||||
close_range(STDERR_FILENO + 1, ~0U);
|
||||
close_range(STDERR_FILENO + 1, ~0U, 0);
|
||||
# else
|
||||
ul_close_all_fds(STDERR_FILENO + 1, ~0U);
|
||||
# endif
|
||||
|
|
|
@ -1357,7 +1357,7 @@ static void initialize(int argc, char **argv, struct login_context *cxt)
|
|||
#endif
|
||||
}
|
||||
#ifdef HAVE_CLOSE_RANGE
|
||||
close_range(STDERR_FILENO + 1, ~0U);
|
||||
close_range(STDERR_FILENO + 1, ~0U, 0);
|
||||
#else
|
||||
ul_close_all_fds(STDERR_FILENO + 1, ~0U);
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue