vshost-util-vserver

Build script and sources for util-vserver.
git clone https://ccx.te2000.cz/git/vshost-util-vserver
Log | Files | Refs

commit 210a9e4a694033baad46af469f883a88d4754fa1
parent 2a1f53afc6eaa5ddfbebad6984b34966613d085a
Author: root <root@dorje.v103.te2000>
Date:   Wed, 10 Nov 2021 21:16:15 +0000

patch for musl

Diffstat:
Mutil-vserver/compat.h | 2+-
Mutil-vserver/ensc_fmt/fmt-32.c | 3+++
Mutil-vserver/ensc_fmt/fmt-64.c | 3+++
Mutil-vserver/ensc_fmt/fmt-internal.h | 8++++++++
Mutil-vserver/ensc_fmt/fmtx-32.c | 3+++
Mutil-vserver/ensc_fmt/fmtx-64.c | 3+++
Mutil-vserver/ensc_wrappers/wrappers-unistd.hc | 8++++++--
Mutil-vserver/lib_internal/matchlist-initmanually.c | 2+-
Mutil-vserver/src/rebootmgr.c | 1+
Mutil-vserver/src/rpm-fake-resolver.c | 2+-
Mutil-vserver/src/vshelper-sync.c | 1+
Mutil-vserver/src/vunify.c | 2+-
Mutil-vserver/tests/escaperoot.c | 2+-
13 files changed, 33 insertions(+), 7 deletions(-)

diff --git a/util-vserver/compat.h b/util-vserver/compat.h @@ -93,7 +93,7 @@ typedef uint32_t tag_t; #endif -#if defined(__dietlibc__) +#ifndef TEMP_FAILURE_RETRY #define TEMP_FAILURE_RETRY(expression) \ (__extension__ \ ({ long int __result; \ diff --git a/util-vserver/ensc_fmt/fmt-32.c b/util-vserver/ensc_fmt/fmt-32.c @@ -23,6 +23,9 @@ #define FMT_BITSIZE 32 #include "fmt.hc" +#ifndef __WORDSIZE +#error __WORDSIZE is not defined (see fmt-internal.h) +#endif #if __WORDSIZE==FMT_BITSIZE size_t FMT_P(ulong_base)(char *ptr, unsigned long val, char base) ALIASFUNC(uint32_base); size_t FMT_P( long_base)(char *ptr, long val, char base) ALIASFUNC( int32_base); diff --git a/util-vserver/ensc_fmt/fmt-64.c b/util-vserver/ensc_fmt/fmt-64.c @@ -23,6 +23,9 @@ #define FMT_BITSIZE 64 #include "fmt.hc" +#ifndef __WORDSIZE +#error __WORDSIZE is not defined (see fmt-internal.h) +#endif #if __WORDSIZE==64 size_t FMT_P(ulong_base)(char *ptr, unsigned long val, char base) ALIASFUNC(uint64_base); size_t FMT_P( long_base)(char *ptr, long val, char base) ALIASFUNC( int64_base); diff --git a/util-vserver/ensc_fmt/fmt-internal.h b/util-vserver/ensc_fmt/fmt-internal.h @@ -56,5 +56,13 @@ return l; \ } while (0) +#ifndef __WORDSIZE +#include <limits.h> +#if (ULONG_MAX == 0xffffffff) +#define __WORDSIZE 32 +#elif (ULONG_MAX == 0xffffffffffffffff) +#define __WORDSIZE 64 +#endif +#endif #endif // H_UTIL_VSERVER_LIB_FMT_COMMON_H diff --git a/util-vserver/ensc_fmt/fmtx-32.c b/util-vserver/ensc_fmt/fmtx-32.c @@ -23,6 +23,9 @@ #define FMT_BITSIZE 32 #include "fmtx.hc" +#ifndef __WORDSIZE +#error __WORDSIZE is not defined (see fmt-internal.h) +#endif #if __WORDSIZE==FMT_BITSIZE size_t FMT_P(xulong)(char *ptr, unsigned long val) ALIASFUNC(xuint32); size_t FMT_P( xlong)(char *ptr, long val) ALIASFUNC( xint32); diff --git a/util-vserver/ensc_fmt/fmtx-64.c b/util-vserver/ensc_fmt/fmtx-64.c @@ -23,6 +23,9 @@ #define FMT_BITSIZE 64 #include "fmtx.hc" +#ifndef __WORDSIZE +#error __WORDSIZE is not defined (see fmt-internal.h) +#endif #if __WORDSIZE==FMT_BITSIZE size_t FMT_P(xulong)(char *ptr, unsigned long val) ALIASFUNC(xuint64); size_t FMT_P( xlong)(char *ptr, long val) ALIASFUNC( xint64); diff --git a/util-vserver/ensc_wrappers/wrappers-unistd.hc b/util-vserver/ensc_wrappers/wrappers-unistd.hc @@ -19,6 +19,10 @@ # error wrappers_handler.hc can not be used in this way #endif +// for initgroups() +#include <sys/types.h> +#include <grp.h> + inline static WRAPPER_DECL void Eclose(int s) { @@ -156,7 +160,7 @@ Esetgid(gid_t gid) FatalErrnoError(setgid(gid)==-1, "setgid()"); } -#if defined(_GRP_H) && (defined(__USE_BSD) || defined(_DEFAULT_SOURCE) || defined(__dietlibc__)) +// #if defined(_GRP_H) && (defined(__USE_BSD) || defined(_DEFAULT_SOURCE) || defined(__dietlibc__)) inline static void Esetgroups(size_t size, const gid_t *list) { @@ -168,7 +172,7 @@ Einitgroups(const char *user, gid_t group) { FatalErrnoError(initgroups(user, group)==-1, "initgroups()"); } -#endif +// #endif inline static WRAPPER_DECL int Edup2(int oldfd, int newfd) diff --git a/util-vserver/lib_internal/matchlist-initmanually.c b/util-vserver/lib_internal/matchlist-initmanually.c @@ -24,7 +24,7 @@ #include "matchlist.h" #include "util-io.h" -#include <wait.h> +#include <sys/wait.h> #include <errno.h> #include <assert.h> #include <fcntl.h> diff --git a/util-vserver/src/rebootmgr.c b/util-vserver/src/rebootmgr.c @@ -54,6 +54,7 @@ #include <sys/socket.h> #include <sys/un.h> #include <alloca.h> +#include <string.h> static void usage() { diff --git a/util-vserver/src/rpm-fake-resolver.c b/util-vserver/src/rpm-fake-resolver.c @@ -286,7 +286,7 @@ int main(int argc, char * argv[]) }; int pid_fd = -1; -#ifndef __dietlibc__ +#ifdef __GLIBC__ # warning *** rpm-fake-resolver is built against glibc; please do not report errors before trying a dietlibc version *** WRITE_MSG(2, "*** rpm-fake-resolver was built with glibc; please do ***\n" diff --git a/util-vserver/src/vshelper-sync.c b/util-vserver/src/vshelper-sync.c @@ -22,6 +22,7 @@ #include "util.h" +#include <sys/select.h> #include <stdlib.h> #include <fcntl.h> #include <unistd.h> diff --git a/util-vserver/src/vunify.c b/util-vserver/src/vunify.c @@ -36,7 +36,7 @@ #include <unistd.h> #include <stdbool.h> #include <errno.h> -#include <wait.h> +#include <sys/wait.h> #include <fcntl.h> #include <assert.h> diff --git a/util-vserver/tests/escaperoot.c b/util-vserver/tests/escaperoot.c @@ -29,7 +29,7 @@ #include <errno.h> #include <sys/stat.h> #include <fcntl.h> -#include <wait.h> +#include <sys/wait.h> #include <limits.h> static void print_pwd()