Skip to content

Instantly share code, notes, and snippets.

View kaworu's full-sized avatar

Alexandre Perrin kaworu

View GitHub Profile
@kaworu
kaworu / gist:5047044
Created February 27, 2013 10:45
lua-sysctl patch: make it compile against both FreeBSD versions previous to 9.0 and 9.0
diff --git a/src/lua_sysctl.c b/src/lua_sysctl.c
index 8cfe3e7..2e23b98 100644
--- a/src/lua_sysctl.c
+++ b/src/lua_sysctl.c
@@ -74,9 +74,13 @@ static int ctl_size[CTLTYPE+1] = {
[CTLTYPE_UINT] = sizeof(u_int),
[CTLTYPE_LONG] = sizeof(long),
[CTLTYPE_ULONG] = sizeof(u_long),
+#if _FreeBSD_version < 900000
+ [CTLTYPE_QUAD] = sizeof(quad_t),
diff --git a/pkg/progressmeter.c b/pkg/progressmeter.c
index fddab1f..a33917c 100644
--- a/pkg/progressmeter.c
+++ b/pkg/progressmeter.c
@@ -183,7 +183,7 @@ refresh_progress_meter(void)
else
percent = 100;
- snprintf(buf + strlen(buf), win_size - strlen(buf-8),
+ snprintf(buf + strlen(buf), win_size - strlen(buf) - 8,
@kaworu
kaworu / libelf.patch
Created March 8, 2013 15:32
gcc48 pkgng patch (libelf)
diff --git a/external/libelf/elf_update.c b/external/libelf/elf_update.c
index 900ed2a..d5d41e3 100644
--- a/external/libelf/elf_update.c
+++ b/external/libelf/elf_update.c
@@ -502,7 +502,7 @@ _libelf_resync_sections(Elf *e, off_t rc, struct _Elf_Extent_List *extents)
static off_t
_libelf_resync_elf(Elf *e, struct _Elf_Extent_List *extents)
{
- int ec, eh_class, eh_type;
+ int ec, eh_class;
@kaworu
kaworu / pkg_ports.c.patch
Created March 8, 2013 15:40
gcc48 pkgng patch
diff --git a/libpkg/pkg_ports.c b/libpkg/pkg_ports.c
index afc4a00..e856c03 100644
--- a/libpkg/pkg_ports.c
+++ b/libpkg/pkg_ports.c
@@ -340,7 +340,7 @@ file(struct plist *p, char *line, struct file_attr *a)
cleanup:
free_file_attr(a);
- return (EPKG_OK);
+ return (ret);
@kaworu
kaworu / pkg.h.patch
Created March 8, 2013 15:43
gcc48 pkgng patch
diff --git a/libpkg/private/pkg.h b/libpkg/private/pkg.h
index f6ad119..a92fdcf 100644
--- a/libpkg/private/pkg.h
+++ b/libpkg/private/pkg.h
@@ -70,8 +70,7 @@
struct type *hf1, *hf2; \
HASH_ITER(hh, data, hf1, hf2) { \
HASH_DEL(data, hf1); \
- if (free_func != NULL) \
- free_func(hf1); \
@kaworu
kaworu / gist:5117380
Created March 8, 2013 15:49
gcc48 pkgng patch
diff --git a/pkg/fetch.c b/pkg/fetch.c
index becbbd1..6da800d 100644
--- a/pkg/fetch.c
+++ b/pkg/fetch.c
@@ -43,9 +43,9 @@
void
usage_fetch(void)
{
- fprintf(stderr, "usage: pkg fetch [-r reponame] [-dgiLqxy] <pkg-name> <...>\n");
- fprintf(stderr, " pkg fetch [-r reponame] [-dLqy] -a\n");
@kaworu
kaworu / gist:5160083
Created March 14, 2013 09:43
pkgng 1.0.9 `update -f' segfault backtrace and infos
% sudo gdb ./pkg-static/pkg-static
GNU gdb 6.1.1 [FreeBSD]
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "amd64-marcel-freebsd"...
(gdb) run update -f
Starting program: /usr/home/alex/code/pkgng/pkg-static/pkg-static update -f
@kaworu
kaworu / libelf_gcc48.patch
Created March 20, 2013 09:53
libelf patch to build with gcc48
Index: trunk/libelf/elf_update.c
===================================================================
--- trunk/libelf/elf_update.c (revision 2930)
+++ trunk/libelf/elf_update.c (working copy)
@@ -502,7 +502,7 @@
static off_t
_libelf_resync_elf(Elf *e, struct _Elf_Extent_List *extents)
{
- int ec, eh_class, eh_type;
+ int ec, eh_class;
@kaworu
kaworu / 0001-Fix-build-with-gcc48-free_func-is-never-NULL.patch
Last active December 15, 2015 04:49
pkgng patches to build with gcc48
From 84f23ecf8d1410216336257c16a374b9d420be44 Mon Sep 17 00:00:00 2001
From: Alexandre Perrin <alexandre.perrin@netoxygen.ch>
Date: Fri, 8 Mar 2013 17:25:22 +0100
Subject: [PATCH] Fix build with gcc48: free_func is never NULL.
---
libpkg/private/pkg.h | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/libpkg/private/pkg.h b/libpkg/private/pkg.h
@kaworu
kaworu / gist:5205315
Created March 20, 2013 14:56
pkgng patch
diff --git a/pkg/fetch.c b/pkg/fetch.c
index f0c9dc4..12ddd08 100644
--- a/pkg/fetch.c
+++ b/pkg/fetch.c
@@ -55,7 +55,7 @@ exec_fetch(int argc, char **argv)
{
struct pkgdb *db = NULL;
struct pkg_jobs *jobs = NULL;
- const char *reponame = NULL;
+ const char __unused *reponame = NULL;