mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 17:10:48 +00:00
Use closefrom() if available
This commit is contained in:
parent
15ff083a9a
commit
ae9892db11
5 changed files with 27 additions and 0 deletions
|
@ -1,3 +1,11 @@
|
|||
2023-11-14 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* configure.ac: Add check for closefrom()
|
||||
* configure: regenerate
|
||||
* Headers/GNUstepBase/config.h.in: regenerate
|
||||
* Source/NSTask.m: Use closefrom() to close descriptors in child
|
||||
process if it is available.
|
||||
|
||||
2023-10-26 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/NSISO8601DateFormatter.m:
|
||||
|
|
|
@ -198,6 +198,9 @@
|
|||
/* Define to 1 if you have the <callback.h> header file. */
|
||||
#undef HAVE_CALLBACK_H
|
||||
|
||||
/* Define to 1 if you have the `closefrom' function. */
|
||||
#undef HAVE_CLOSEFROM
|
||||
|
||||
/* Define to 1 if you have the `ctime' function. */
|
||||
#undef HAVE_CTIME
|
||||
|
||||
|
|
|
@ -1773,10 +1773,14 @@ GSPrivateCheckTasks()
|
|||
/*
|
||||
* Close any extra descriptors.
|
||||
*/
|
||||
#if defined(HAVE_CLOSEFROM)
|
||||
closefrom(3);
|
||||
#else
|
||||
for (i = 3; i < NOFILE; i++)
|
||||
{
|
||||
(void) close(i);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (0 != chdir(path))
|
||||
{
|
||||
|
|
11
configure
vendored
11
configure
vendored
|
@ -10167,6 +10167,17 @@ _ACEOF
|
|||
fi
|
||||
done
|
||||
|
||||
for ac_func in closefrom
|
||||
do :
|
||||
ac_fn_c_check_func "$LINENO" "closefrom" "ac_cv_func_closefrom"
|
||||
if test "x$ac_cv_func_closefrom" = xyes; then :
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define HAVE_CLOSEFROM 1
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
done
|
||||
|
||||
if test "x$ac_cv_func_setpgrp" = xyes; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether setpgrp takes no argument" >&5
|
||||
$as_echo_n "checking whether setpgrp takes no argument... " >&6; }
|
||||
|
|
|
@ -2592,6 +2592,7 @@ AC_CHECK_HEADERS(sys/mman.h)
|
|||
# These functions needed by NSTask.m
|
||||
#--------------------------------------------------------------------
|
||||
AC_CHECK_FUNCS(killpg setpgrp setpgid setsid grantpt)
|
||||
AC_CHECK_FUNCS(closefrom)
|
||||
if test "x$ac_cv_func_setpgrp" = xyes; then
|
||||
AC_FUNC_SETPGRP
|
||||
fi
|
||||
|
|
Loading…
Reference in a new issue