# ------------------------------------------------------------------------------
-lib_LTLIBRARIES += \
- libpakfire_preload.la
-
-libpakfire_preload_la_SOURCES = \
- src/libpakfire_preload/uname.c
-
-libpakfire_preload_la_LDFLAGS = \
- $(AM_LDFLAGS) \
- -shared \
- -module \
- -avoid-version
-
-libpakfire_preload_la_LIBADD = \
- $(DL_LIBS)
-
-# ------------------------------------------------------------------------------
-
dist_scripts_SCRIPTS = \
src/scripts/check-buildroot \
src/scripts/check-fhs \
unshare
])
-save_LIBS="$LIBS"
-
-# libdl
-LIBS=
-AC_SEARCH_LIBS([dlsym], [dl], [], [AC_MSG_ERROR([*** Dynamic linking loader library not found])])
-DL_LIBS="$LIBS"
-AC_SUBST(DL_LIBS)
-
-LIBS="$save_LIBS"
-
PKG_CHECK_MODULES([ARCHIVE], [libarchive >= 3.3.3])
PKG_CHECK_MODULES([CURL], [libcurl])
PKG_CHECK_MODULES([PYTHON_DEVEL], [python-${PYTHON_VERSION}-embed],
+++ /dev/null
-
-
-#include <stdio.h>
-#include <string.h>
-#include <dlfcn.h>
-#include <stdlib.h> /* for EXIT_FAILURE */
-#include <unistd.h> /* for _exit() */
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <sys/syslog.h>
-#include <sys/utsname.h>
-
-#ifndef RTLD_NEXT
-#define RTLD_NEXT ((void *) -1l)
-#endif
-
-typedef int (*uname_t)(struct utsname * buf);
-
-static void *get_libc_func(const char *funcname) {
- char *error;
-
- void *func = dlsym(RTLD_NEXT, funcname);
- if ((error = dlerror()) != NULL) {
- fprintf(stderr, "I can't locate libc function `%s' error: %s", funcname, error);
- _exit(EXIT_FAILURE);
- }
-
- return func;
-}
-
-int uname(struct utsname *buf) {
- char *env = NULL;
-
- /* Call real uname to get the information we need. */
- uname_t real_uname = (uname_t)get_libc_func("uname");
- int ret = real_uname((struct utsname *) buf);
-
- /* Replace release if requested. */
- if ((env = getenv("UTS_RELEASE")) != NULL) {
- snprintf(buf->release, sizeof(buf->release) - 1, "%s", env);
- }
-
- /* Replace machine type if requested. */
- if ((env = getenv("UTS_MACHINE")) != NULL) {
- snprintf(buf->machine, sizeof(buf->machine) - 1, "%s", env);
- }
-
- return ret;
-}