Remove `closefrom` from libopenbsd to build with glibc > 2.34

This commit is contained in:
Nathan Fisher 2022-05-01 08:56:24 -04:00
parent 38be98f284
commit 8fc87adccb
9 changed files with 4 additions and 130 deletions

View File

@ -29,11 +29,11 @@ file_version = 5.40
findutils_version = 4.8.0
flex_version = 2.6.4
gawk_version = 5.1.1
gcc_version = 11.2.0
gcc_version = 11.3.0
gdbm_version = 1.19
gettext_version = 0.21
gettext-tiny_version = 0.3.2
glibc_version = 2.33
glibc_version = 2.35
gmp_version = 6.2.1
gperf_version = 3.1
grep_version = 3.6
@ -56,7 +56,7 @@ libnl_version = 3.5.0
libressl_version = 3.0.2
libtool_version = 2.4.6
libz_version = 1.2.8.2015.12.26
linux_version = 5.17.1
linux_version = 5.17.5
linux_rpi_version = 5.4.45
m4_version = 1.4.19
make_version = 4.3

View File

@ -43,7 +43,6 @@
#define STDERR_FILENO 2 /* standard error file descriptor */
int execvpe(const char *, char *const *, char *const *);
int closefrom(int);
int crypt_newhash(const char *, const char *, char *, size_t);
int getdtablecount(void);
int getentropy(void *, size_t);

View File

@ -5,7 +5,6 @@ distname = glibc
patches += glibc-2.31-fhs-1.patch
patches += glibc-no-test-installation.patch
patches += ldd-rewrite-nobash.patch
include world.mk
-include locales.mk

View File

@ -5,7 +5,6 @@ distname = glibc
patches += glibc-2.31-fhs-1.patch
patches += glibc-no-test-installation.patch
patches += ldd-rewrite-nobash.patch
include world.mk
-include locales.mk

View File

@ -1,12 +0,0 @@
diff -Naur glibc-2.31.orig/elf/Makefile glibc-2.31/elf/Makefile
--- glibc-2.31.orig/elf/Makefile 2020-02-01 06:52:50.000000000 -0500
+++ glibc-2.31/elf/Makefile 2020-07-13 10:21:19.374415161 -0400
@@ -594,7 +594,7 @@
-e 's%@VERSION@%$(version)%g' \
-e 's|@PKGVERSION@|$(PKGVERSION)|g' \
-e 's|@REPORT_BUGS_TO@|$(REPORT_BUGS_TO)|g' \
- -e 's%@BASH@%$(BASH)%g' \
+ -e 's%@BASH@%/bin/sh%g' \
-e 's%@TEXTDOMAINDIR@%$(localedir)%g'
ifeq ($(ldd-rewrite-script),no)

View File

@ -3,7 +3,7 @@
# compat sources
VPATH+= ${LIBCSRCDIR}/compat
SRCS+= fgetwln.c open.c setproctitle.c pledge-noop.c closefrom.c
SRCS+= fgetwln.c open.c setproctitle.c pledge-noop.c
include ${.TOPDIR}/config.mk

View File

@ -1,109 +0,0 @@
/*
* Copyright (c) 2004-2005 Todd C. Miller <Todd.Miller@courtesan.com>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef HAVE_CLOSEFROM
#include <sys/types.h>
#include <sys/param.h>
#include <unistd.h>
#include <stdio.h>
#ifdef HAVE_FCNTL_H
# include <fcntl.h>
#endif
#include <limits.h>
#include <stdlib.h>
#include <stddef.h>
#include <string.h>
#include <unistd.h>
#ifdef HAVE_DIRENT_H
# include <dirent.h>
# define NAMLEN(dirent) strlen((dirent)->d_name)
#else
# define dirent direct
# define NAMLEN(dirent) (dirent)->d_namlen
# ifdef HAVE_SYS_NDIR_H
# include <sys/ndir.h>
# endif
# ifdef HAVE_SYS_DIR_H
# include <sys/dir.h>
# endif
# ifdef HAVE_NDIR_H
# include <ndir.h>
# endif
#endif
#ifndef OPEN_MAX
# define OPEN_MAX 256
#endif
#if 0
__unused static const char rcsid[] = "$Sudo: closefrom.c,v 1.11 2006/08/17 15:26:54 millert Exp $";
#endif /* lint */
/*
* Close all file descriptors greater than or equal to lowfd.
*/
#ifdef HAVE_FCNTL_CLOSEM
int
closefrom(int lowfd)
{
(void) fcntl(lowfd, F_CLOSEM, 0);
return 0;
}
#else
int
closefrom(int lowfd)
{
long fd, maxfd;
#if defined(HAVE_DIRFD) && defined(HAVE_PROC_PID)
char fdpath[PATH_MAX], *endp;
struct dirent *dent;
DIR *dirp;
int len;
/* Check for a /proc/$$/fd directory. */
len = snprintf(fdpath, sizeof(fdpath), "/proc/%ld/fd", (long)getpid());
if (len > 0 && (size_t)len <= sizeof(fdpath) && (dirp = opendir(fdpath))) {
while ((dent = readdir(dirp)) != NULL) {
fd = strtol(dent->d_name, &endp, 10);
if (dent->d_name != endp && *endp == '\0' &&
fd >= 0 && fd < INT_MAX && fd >= lowfd && fd != dirfd(dirp))
(void) close((int) fd);
}
(void) closedir(dirp);
} else
#endif
{
/*
* Fall back on sysconf() or getdtablesize(). We avoid checking
* resource limits since it is possible to open a file descriptor
* and then drop the rlimit such that it is below the open fd.
*/
#ifdef HAVE_SYSCONF
maxfd = sysconf(_SC_OPEN_MAX);
#else
maxfd = getdtablesize();
#endif /* HAVE_SYSCONF */
if (maxfd < 0)
maxfd = OPEN_MAX;
for (fd = lowfd; fd < maxfd; fd++)
(void) close((int) fd);
}
return 0;
}
#endif /* !HAVE_FCNTL_CLOSEM */
#endif /* HAVE_CLOSEFROM */

View File

@ -121,7 +121,6 @@ objs += $(objdir)/fgetwln.o
objs += $(objdir)/open.o
objs += $(objdir)/setproctitle.o
objs += $(objdir)/pledge-noop.o
objs += $(objdir)/closefrom.o
objs += $(objdir)/fgetln.o
objs += $(objdir)/freezero.o
objs += $(objdir)/getdtablecount.o

View File

@ -43,7 +43,6 @@
#define STDERR_FILENO 2 /* standard error file descriptor */
int execvpe(const char *, char *const *, char *const *);
int closefrom(int);
int crypt_newhash(const char *, const char *, char *, size_t);
int getdtablecount(void);
int getentropy(void *, size_t);