Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Port pkgng to OpenBSD and Bitrig.
Yonas Yanfa committed 10 years ago
commit a45b4731689c21a97d921aa153240eefa922dee8
parent fede6dd
6 files changed +80 -3
modified compat/bsd_compat.h
@@ -29,6 +29,12 @@

#include "pkg_config.h"

+
#ifdef __OpenBSD__
+
 #ifndef EPROTO
+
  #define EPROTO EINTR
+
 #endif
+
#endif
+

#ifdef HAVE_BSD_SYS_CDEFS_H
#include <bsd/sys/cdefs.h>
#endif
modified configure.ac
@@ -335,14 +335,30 @@ AC_CHECK_FUNCS(cap_sandboxed, [

AC_CACHE_CHECK(for arc4random_uniform,
               ac_cv_func_arc4random_uniform,
-
               [AC_TRY_COMPILE([#include <stdlib.h>],
+
               [ac_save_CFLAGS="$CFLAGS"
+
                CFLAGS="-Werror $CFLAGS"
+
                AC_TRY_COMPILE([#include <stdlib.h>],
                               [arc4random_uniform(255);],
                               [ac_cv_func_arc4random_uniform=yes],
-
                               [ac_cv_func_arc4random_uniform=no])])
+
                               [ac_cv_func_arc4random_uniform=no])
+
		CFLAGS="$ac_save_CFLAGS"])
if test "$ac_cv_func_arc4random_uniform" = yes ; then
	AC_DEFINE(HAVE_ARC4RANDOM, 1, [Define 1 if you have 'arc4random_uniform' function.])
fi

+
AC_CACHE_CHECK(for arc4random_stir,
+
               ac_cv_func_arc4random_stir,
+
               [ac_save_CFLAGS="$CFLAGS"
+
                CFLAGS="-Werror $CFLAGS"
+
                AC_TRY_COMPILE([#include <stdlib.h>],
+
                               [arc4random_stir();],
+
                               [ac_cv_func_arc4random_stir=yes],
+
                               [ac_cv_func_arc4random_stir=no])
+
		CFLAGS="$ac_save_CFLAGS"])
+
if test "$ac_cv_func_arc4random_stir" = yes ; then
+
   AC_DEFINE(HAVE_ARC4RANDOM_STIR, 1, [Define 1 if you have 'arc4random_stir' function.])
+
fi
+

AC_CACHE_CHECK(for BSD dirname(const char *),
               ac_cv_func_dirname,
               [ac_save_CFLAGS="$CFLAGS"
modified external/libelf/elf.c
@@ -25,9 +25,14 @@
 */

#include <libelf.h>
+
/*
+
#include "/usr/include/sys/exec_elf.h"
+
*/

#include "_libelf.h"

+
#define EM_AMD64    62
+

ELFTC_VCSID("$Id$");

struct _libelf_globals _libelf = {
modified libpkg/dns_utils.c
@@ -40,6 +40,39 @@
#endif
#include <netdb.h>

+
#ifndef NS_QFIXEDSZ
+
#define NS_QFIXEDSZ     4       /*%< #/bytes of fixed data in query */
+
#endif
+

+
#ifndef NS_INT16SZ
+
#define NS_INT16SZ      2       /*%< #/bytes of data in a u_int16_t */
+
#endif
+

+
#ifndef NS_INT32SZ
+
#define NS_INT32SZ      4       /*%< #/bytes of data in a u_int32_t */
+
#endif
+

+
/*%
+
 * Inline versions of get/put short/long.  Pointer is advanced.
+
 */
+
#define NS_GET16(s, cp) do { \
+
        register const u_char *t_cp = (const u_char *)(cp); \
+
        (s) = ((u_int16_t)t_cp[0] << 8) \
+
            | ((u_int16_t)t_cp[1]) \
+
            ; \
+
        (cp) += NS_INT16SZ; \
+
} while (0)
+

+
#define NS_GET32(l, cp) do { \
+
        register const u_char *t_cp = (const u_char *)(cp); \
+
        (l) = ((u_int32_t)t_cp[0] << 24) \
+
            | ((u_int32_t)t_cp[1] << 16) \
+
            | ((u_int32_t)t_cp[2] << 8) \
+
            | ((u_int32_t)t_cp[3]) \
+
            ; \
+
        (cp) += NS_INT32SZ; \
+
} while (0)
+

#include <bsd_compat.h>
#include "private/utils.h"
#include "pkg.h"
modified src/main.c
@@ -63,6 +63,22 @@

#include "pkgcli.h"

+
#ifndef _HUMANIZE_NUMBER
+
#define _HUMANIZE_NUMBER
+

+
#include <util.h>
+
#include <errno.h>
+
int humanize_number(char *buf, size_t len, int64_t number, const char *suffix, int scale, int flags) {
+
    if (len < FMT_SCALED_STRSIZE) {
+
        return -1;
+
    }
+
    else if (fmt_scaled(number, buf) == 0)
+
        return 0;
+
    else
+
        return errno;
+
}
+
#endif
+

/* Used to define why do we show usage message to a user */
enum pkg_usage_reason {
	PKG_USAGE_ERROR,
@@ -690,7 +706,7 @@ main(int argc, char **argv)
	if (debug == 0 && version == 0)
		start_process_worker(save_argv);

-
#ifdef HAVE_ARC4RANDOM
+
#ifdef HAVE_ARC4RANDOM_STIR
	/* Ensure that random is stirred after a possible fork */
	arc4random_stir();
#endif
modified src/pkgcli.h
@@ -30,6 +30,7 @@

#include <stdint.h>
#include <bsd_compat.h>
+
#include "external/libelf/_elftc.h"

#define pkg_warnx(fmt, ...) pkg_fprintf(stderr, "%S: " fmt, getprogname(), __VA_ARGS__, -1)