New upstream release (0.3.0)
This commit is contained in:
parent
02d57bd5c8
commit
3755f42dac
1
.gitignore
vendored
1
.gitignore
vendored
@ -1 +1,2 @@
|
|||||||
/libverto-0.2.6.tar.gz
|
/libverto-0.2.6.tar.gz
|
||||||
|
/libverto-0.3.0.tar.gz
|
||||||
|
@ -1,67 +0,0 @@
|
|||||||
From 695322c08c4031d873cd04a4bc7d7589b83368ac Mon Sep 17 00:00:00 2001
|
|
||||||
From: Robbie Harwood <rharwood@redhat.com>
|
|
||||||
Date: Wed, 2 Aug 2017 16:58:44 -0400
|
|
||||||
Subject: [PATCH] Add Travis support
|
|
||||||
|
|
||||||
(cherry picked from commit caf08f984596eeb77fdcb80009951f201e03b370)
|
|
||||||
---
|
|
||||||
.travis.sh | 23 +++++++++++++++++++++++
|
|
||||||
.travis.yml | 19 +++++++++++++++++++
|
|
||||||
2 files changed, 42 insertions(+)
|
|
||||||
create mode 100755 .travis.sh
|
|
||||||
create mode 100644 .travis.yml
|
|
||||||
|
|
||||||
diff --git a/.travis.sh b/.travis.sh
|
|
||||||
new file mode 100755
|
|
||||||
index 0000000..e404e9a
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/.travis.sh
|
|
||||||
@@ -0,0 +1,23 @@
|
|
||||||
+#!/bin/bash -ex
|
|
||||||
+
|
|
||||||
+if [ -f /etc/debian_version ]; then
|
|
||||||
+ apt-get update
|
|
||||||
+ apt-get -y install autoconf build-essential libtool \
|
|
||||||
+ lib{ev,event,glib2.0}-dev
|
|
||||||
+elif [ -f /etc/fedora-release ]; then
|
|
||||||
+ # dnf has no update-only verb
|
|
||||||
+ dnf -y install autoconf automake libtool make \
|
|
||||||
+ {glib2,libevent,libev}-devel
|
|
||||||
+elif [ -f /etc/redhat-release ]; then
|
|
||||||
+ # rhel/centos
|
|
||||||
+ yum -y install autoconf automake libtool make \
|
|
||||||
+ {glib2,libevent}-devel
|
|
||||||
+else
|
|
||||||
+ echo "Distro not found!"
|
|
||||||
+ false
|
|
||||||
+fi
|
|
||||||
+
|
|
||||||
+autoreconf -fiv
|
|
||||||
+./configure
|
|
||||||
+make
|
|
||||||
+make check
|
|
||||||
diff --git a/.travis.yml b/.travis.yml
|
|
||||||
new file mode 100644
|
|
||||||
index 0000000..4c63f28
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/.travis.yml
|
|
||||||
@@ -0,0 +1,19 @@
|
|
||||||
+sudo: required
|
|
||||||
+
|
|
||||||
+# not necessary, but less confusing if defined
|
|
||||||
+language: C
|
|
||||||
+
|
|
||||||
+services:
|
|
||||||
+ - docker
|
|
||||||
+
|
|
||||||
+env:
|
|
||||||
+ - DISTRO=debian:sid
|
|
||||||
+ - DISTRO=fedora:rawhide
|
|
||||||
+ - DISTRO=centos:7
|
|
||||||
+
|
|
||||||
+script:
|
|
||||||
+ - >
|
|
||||||
+ docker run
|
|
||||||
+ -v `pwd`:/tmp/build
|
|
||||||
+ -w /tmp/build
|
|
||||||
+ $DISTRO /bin/bash -ex .travis.sh
|
|
@ -1,57 +0,0 @@
|
|||||||
From 3d0272265e89adfcc790d697d07cbc42be1b7b2e Mon Sep 17 00:00:00 2001
|
|
||||||
From: Robbie Harwood <rharwood@redhat.com>
|
|
||||||
Date: Wed, 2 Aug 2017 18:48:02 -0400
|
|
||||||
Subject: [PATCH] Add a CI target for clang
|
|
||||||
|
|
||||||
(cherry picked from commit b1cb74d3db1f6377508282d0d98e197b5c654295)
|
|
||||||
---
|
|
||||||
.travis.sh | 6 +++---
|
|
||||||
.travis.yml | 8 +++++---
|
|
||||||
2 files changed, 8 insertions(+), 6 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/.travis.sh b/.travis.sh
|
|
||||||
index e404e9a..3be21ac 100755
|
|
||||||
--- a/.travis.sh
|
|
||||||
+++ b/.travis.sh
|
|
||||||
@@ -2,15 +2,15 @@
|
|
||||||
|
|
||||||
if [ -f /etc/debian_version ]; then
|
|
||||||
apt-get update
|
|
||||||
- apt-get -y install autoconf build-essential libtool \
|
|
||||||
+ apt-get -y install autoconf build-essential libtool $CC \
|
|
||||||
lib{ev,event,glib2.0}-dev
|
|
||||||
elif [ -f /etc/fedora-release ]; then
|
|
||||||
# dnf has no update-only verb
|
|
||||||
- dnf -y install autoconf automake libtool make \
|
|
||||||
+ dnf -y install autoconf automake libtool make $CC \
|
|
||||||
{glib2,libevent,libev}-devel
|
|
||||||
elif [ -f /etc/redhat-release ]; then
|
|
||||||
# rhel/centos
|
|
||||||
- yum -y install autoconf automake libtool make \
|
|
||||||
+ yum -y install autoconf automake libtool make $CC \
|
|
||||||
{glib2,libevent}-devel
|
|
||||||
else
|
|
||||||
echo "Distro not found!"
|
|
||||||
diff --git a/.travis.yml b/.travis.yml
|
|
||||||
index 4c63f28..0def685 100644
|
|
||||||
--- a/.travis.yml
|
|
||||||
+++ b/.travis.yml
|
|
||||||
@@ -7,13 +7,15 @@ services:
|
|
||||||
- docker
|
|
||||||
|
|
||||||
env:
|
|
||||||
- - DISTRO=debian:sid
|
|
||||||
- - DISTRO=fedora:rawhide
|
|
||||||
- - DISTRO=centos:7
|
|
||||||
+ - DISTRO=debian:sid CC=gcc
|
|
||||||
+ - DISTRO=fedora:rawhide CC=gcc
|
|
||||||
+ - DISTRO=fedora:rawhide CC=clang
|
|
||||||
+ - DISTRO=centos:7 CC=gcc
|
|
||||||
|
|
||||||
script:
|
|
||||||
- >
|
|
||||||
docker run
|
|
||||||
-v `pwd`:/tmp/build
|
|
||||||
-w /tmp/build
|
|
||||||
+ -e CC=$CC
|
|
||||||
$DISTRO /bin/bash -ex .travis.sh
|
|
@ -1,362 +0,0 @@
|
|||||||
From 58c68cae4db04a25f567c61be7d1d70543aa56a2 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Robbie Harwood <rharwood@redhat.com>
|
|
||||||
Date: Wed, 2 Aug 2017 18:42:57 -0400
|
|
||||||
Subject: [PATCH] Enable (and fix) all warnings
|
|
||||||
|
|
||||||
(cherry picked from commit 11366334b528f99c38c1323b428de9578691ff7d)
|
|
||||||
---
|
|
||||||
.travis.sh | 8 ++++----
|
|
||||||
.travis.yml | 10 +++++-----
|
|
||||||
configure.ac | 5 +++++
|
|
||||||
src/module.c | 6 ++++--
|
|
||||||
src/verto-glib.c | 10 +++++++++-
|
|
||||||
src/verto-libev.c | 5 +++++
|
|
||||||
src/verto-libevent.c | 5 +++++
|
|
||||||
src/verto.c | 4 ++--
|
|
||||||
src/verto.h | 1 +
|
|
||||||
tests/child.c | 9 +++++++++
|
|
||||||
tests/idle.c | 4 ++++
|
|
||||||
tests/read.c | 2 ++
|
|
||||||
tests/signal.c | 3 +++
|
|
||||||
tests/test.h | 1 +
|
|
||||||
tests/timeout.c | 1 +
|
|
||||||
tests/write.c | 2 ++
|
|
||||||
16 files changed, 62 insertions(+), 14 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/.travis.sh b/.travis.sh
|
|
||||||
index 3be21ac..d8fe415 100755
|
|
||||||
--- a/.travis.sh
|
|
||||||
+++ b/.travis.sh
|
|
||||||
@@ -2,15 +2,15 @@
|
|
||||||
|
|
||||||
if [ -f /etc/debian_version ]; then
|
|
||||||
apt-get update
|
|
||||||
- apt-get -y install autoconf build-essential libtool $CC \
|
|
||||||
+ apt-get -y install autoconf build-essential libtool $COMPILER \
|
|
||||||
lib{ev,event,glib2.0}-dev
|
|
||||||
elif [ -f /etc/fedora-release ]; then
|
|
||||||
# dnf has no update-only verb
|
|
||||||
- dnf -y install autoconf automake libtool make $CC \
|
|
||||||
+ dnf -y install autoconf automake libtool make which $COMPILER \
|
|
||||||
{glib2,libevent,libev}-devel
|
|
||||||
elif [ -f /etc/redhat-release ]; then
|
|
||||||
# rhel/centos
|
|
||||||
- yum -y install autoconf automake libtool make $CC \
|
|
||||||
+ yum -y install autoconf automake libtool make which $COMPILER \
|
|
||||||
{glib2,libevent}-devel
|
|
||||||
else
|
|
||||||
echo "Distro not found!"
|
|
||||||
@@ -18,6 +18,6 @@ else
|
|
||||||
fi
|
|
||||||
|
|
||||||
autoreconf -fiv
|
|
||||||
-./configure
|
|
||||||
+./configure CFLAGS=-Werror CC=$(which $COMPILER)
|
|
||||||
make
|
|
||||||
make check
|
|
||||||
diff --git a/.travis.yml b/.travis.yml
|
|
||||||
index 0def685..bda4236 100644
|
|
||||||
--- a/.travis.yml
|
|
||||||
+++ b/.travis.yml
|
|
||||||
@@ -7,15 +7,15 @@ services:
|
|
||||||
- docker
|
|
||||||
|
|
||||||
env:
|
|
||||||
- - DISTRO=debian:sid CC=gcc
|
|
||||||
- - DISTRO=fedora:rawhide CC=gcc
|
|
||||||
- - DISTRO=fedora:rawhide CC=clang
|
|
||||||
- - DISTRO=centos:7 CC=gcc
|
|
||||||
+ - DISTRO=debian:sid COMPILER=gcc
|
|
||||||
+ - DISTRO=fedora:rawhide COMPILER=gcc
|
|
||||||
+ - DISTRO=fedora:rawhide COMPILER=clang
|
|
||||||
+ - DISTRO=centos:7 COMPILER=gcc
|
|
||||||
|
|
||||||
script:
|
|
||||||
- >
|
|
||||||
docker run
|
|
||||||
-v `pwd`:/tmp/build
|
|
||||||
-w /tmp/build
|
|
||||||
- -e CC=$CC
|
|
||||||
+ -e COMPILER=$COMPILER
|
|
||||||
$DISTRO /bin/bash -ex .travis.sh
|
|
||||||
diff --git a/configure.ac b/configure.ac
|
|
||||||
index d109617..db3a9c3 100644
|
|
||||||
--- a/configure.ac
|
|
||||||
+++ b/configure.ac
|
|
||||||
@@ -3,6 +3,11 @@ dnl Process this file with autoconf to produce a configure script.
|
|
||||||
AC_PREREQ(2.59)
|
|
||||||
AC_INIT(libverto, 0.2.6)
|
|
||||||
|
|
||||||
+m4_ifdef([AC_USE_SYSTEM_EXTENSIONS],
|
|
||||||
+ [AC_USE_SYSTEM_EXTENSIONS],
|
|
||||||
+ [AC_GNU_SOURCE])
|
|
||||||
+CFLAGS="$CFLAGS -Wall -Wextra"
|
|
||||||
+
|
|
||||||
AC_CANONICAL_SYSTEM
|
|
||||||
AM_INIT_AUTOMAKE([1.11])
|
|
||||||
|
|
||||||
diff --git a/src/module.c b/src/module.c
|
|
||||||
index d5977cb..1f1b7c9 100644
|
|
||||||
--- a/src/module.c
|
|
||||||
+++ b/src/module.c
|
|
||||||
@@ -86,7 +86,6 @@ dladdr(void* s, Dl_info* i)
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
-#define _GNU_SOURCE
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <dlfcn.h>
|
|
||||||
@@ -101,7 +100,10 @@ module_symbol_is_present(const char *modname, const char *symbname)
|
|
||||||
return (GetProcAddress(GetModuleHandle(modname), symbname) != NULL ||
|
|
||||||
GetProcAddress(GetModuleHandle(NULL), symbname) != NULL);
|
|
||||||
#else /* WIN32 */
|
|
||||||
- void* mod = dlopen(NULL, RTLD_LAZY | RTLD_LOCAL);
|
|
||||||
+ void *mod;
|
|
||||||
+ (void) modname;
|
|
||||||
+
|
|
||||||
+ mod = dlopen(NULL, RTLD_LAZY | RTLD_LOCAL);
|
|
||||||
if (mod) {
|
|
||||||
void* sym = dlsym(mod, symbname);
|
|
||||||
dlclose(mod);
|
|
||||||
diff --git a/src/verto-glib.c b/src/verto-glib.c
|
|
||||||
index 3136ccb..2e0c0f5 100644
|
|
||||||
--- a/src/verto-glib.c
|
|
||||||
+++ b/src/verto-glib.c
|
|
||||||
@@ -66,6 +66,8 @@ typedef struct GIOSource {
|
|
||||||
static gboolean
|
|
||||||
prepare(GSource *source, gint *timeout)
|
|
||||||
{
|
|
||||||
+ (void) source;
|
|
||||||
+
|
|
||||||
*timeout = -1;
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
@@ -92,7 +94,7 @@ finalize(GSource *source)
|
|
||||||
close(src->fd.fd);
|
|
||||||
}
|
|
||||||
|
|
||||||
-static GSourceFuncs funcs = { prepare, check, dispatch, finalize };
|
|
||||||
+static GSourceFuncs funcs = { prepare, check, dispatch, finalize, NULL, NULL };
|
|
||||||
|
|
||||||
static void *
|
|
||||||
glib_convert_(GMainContext *mc, GMainLoop *ml)
|
|
||||||
@@ -195,6 +197,8 @@ glib_callback_io(gpointer data, GIOCondition condition)
|
|
||||||
static void
|
|
||||||
glib_callback_child(GPid pid, gint status, gpointer data)
|
|
||||||
{
|
|
||||||
+ (void) pid;
|
|
||||||
+
|
|
||||||
verto_set_proc_status(data, status);
|
|
||||||
verto_fire(data);
|
|
||||||
}
|
|
||||||
@@ -202,6 +206,8 @@ glib_callback_child(GPid pid, gint status, gpointer data)
|
|
||||||
static void
|
|
||||||
glib_ctx_set_flags(verto_mod_ctx *ctx, const verto_ev *ev, verto_mod_ev *evpriv)
|
|
||||||
{
|
|
||||||
+ (void) ctx;
|
|
||||||
+
|
|
||||||
if (verto_get_flags(ev) & VERTO_EV_FLAG_PRIORITY_HIGH)
|
|
||||||
g_source_set_priority(evpriv, G_PRIORITY_HIGH);
|
|
||||||
else if (verto_get_flags(ev) & VERTO_EV_FLAG_PRIORITY_MEDIUM)
|
|
||||||
@@ -296,6 +302,8 @@ glib_ctx_add(verto_mod_ctx *ctx, const verto_ev *ev, verto_ev_flag *flags)
|
|
||||||
static void
|
|
||||||
glib_ctx_del(verto_mod_ctx *ctx, const verto_ev *ev, verto_mod_ev *evpriv)
|
|
||||||
{
|
|
||||||
+ (void) ctx;
|
|
||||||
+
|
|
||||||
if (!ev)
|
|
||||||
return;
|
|
||||||
|
|
||||||
diff --git a/src/verto-libev.c b/src/verto-libev.c
|
|
||||||
index 9c7c324..99256a2 100644
|
|
||||||
--- a/src/verto-libev.c
|
|
||||||
+++ b/src/verto-libev.c
|
|
||||||
@@ -80,6 +80,11 @@ libev_callback(EV_P_ ev_watcher *w, int revents)
|
|
||||||
{
|
|
||||||
verto_ev_flag state = VERTO_EV_FLAG_NONE;
|
|
||||||
|
|
||||||
+#if EV_MULTIPLICITY
|
|
||||||
+ /* Match the check in ev.h, which doesn't mark this unused */
|
|
||||||
+ (void) EV_A;
|
|
||||||
+#endif
|
|
||||||
+
|
|
||||||
if (verto_get_type(w->data)== VERTO_EV_TYPE_CHILD)
|
|
||||||
verto_set_proc_status(w->data, ((ev_child*) w)->rstatus);
|
|
||||||
|
|
||||||
diff --git a/src/verto-libevent.c b/src/verto-libevent.c
|
|
||||||
index c8f73cd..f1f94e2 100644
|
|
||||||
--- a/src/verto-libevent.c
|
|
||||||
+++ b/src/verto-libevent.c
|
|
||||||
@@ -94,6 +94,8 @@ libevent_callback(evutil_socket_t socket, short type, void *data)
|
|
||||||
{
|
|
||||||
verto_ev_flag state = VERTO_EV_FLAG_NONE;
|
|
||||||
|
|
||||||
+ (void) socket;
|
|
||||||
+
|
|
||||||
if (type & EV_READ)
|
|
||||||
state |= VERTO_EV_FLAG_IO_READ;
|
|
||||||
if (type & EV_WRITE)
|
|
||||||
@@ -163,6 +165,9 @@ libevent_ctx_add(verto_mod_ctx *ctx, const verto_ev *ev, verto_ev_flag *flags)
|
|
||||||
static void
|
|
||||||
libevent_ctx_del(verto_mod_ctx *ctx, const verto_ev *ev, verto_mod_ev *evpriv)
|
|
||||||
{
|
|
||||||
+ (void) ctx;
|
|
||||||
+ (void) ev;
|
|
||||||
+
|
|
||||||
event_del(evpriv);
|
|
||||||
event_free(evpriv);
|
|
||||||
}
|
|
||||||
diff --git a/src/verto.c b/src/verto.c
|
|
||||||
index b14bc76..b98142d 100644
|
|
||||||
--- a/src/verto.c
|
|
||||||
+++ b/src/verto.c
|
|
||||||
@@ -22,8 +22,6 @@
|
|
||||||
* SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
-#define _GNU_SOURCE /* For asprintf() */
|
|
||||||
-
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
@@ -496,6 +494,8 @@ remove_ev(verto_ev **origin, verto_ev *item)
|
|
||||||
static void
|
|
||||||
signal_ignore(verto_ctx *ctx, verto_ev *ev)
|
|
||||||
{
|
|
||||||
+ (void) ctx;
|
|
||||||
+ (void) ev;
|
|
||||||
}
|
|
||||||
|
|
||||||
verto_ctx *
|
|
||||||
diff --git a/src/verto.h b/src/verto.h
|
|
||||||
index 84f21a7..15fd81e 100644
|
|
||||||
--- a/src/verto.h
|
|
||||||
+++ b/src/verto.h
|
|
||||||
@@ -33,6 +33,7 @@
|
|
||||||
typedef HANDLE verto_proc;
|
|
||||||
typedef DWORD verto_proc_status;
|
|
||||||
#else
|
|
||||||
+#include <sys/types.h>
|
|
||||||
typedef pid_t verto_proc;
|
|
||||||
typedef int verto_proc_status;
|
|
||||||
#endif
|
|
||||||
diff --git a/tests/child.c b/tests/child.c
|
|
||||||
index d442cbd..286cda6 100644
|
|
||||||
--- a/tests/child.c
|
|
||||||
+++ b/tests/child.c
|
|
||||||
@@ -36,6 +36,9 @@ static int freed;
|
|
||||||
void
|
|
||||||
exit_cb(verto_ctx *ctx, verto_ev *ev)
|
|
||||||
{
|
|
||||||
+ (void) ctx;
|
|
||||||
+ (void) ev;
|
|
||||||
+
|
|
||||||
if (WEXITSTATUS(exitstatus) != EXITCODE) {
|
|
||||||
printf("ERROR: Child event never fired!\n");
|
|
||||||
retval = 1;
|
|
||||||
@@ -51,12 +54,18 @@ exit_cb(verto_ctx *ctx, verto_ev *ev)
|
|
||||||
void
|
|
||||||
onfree(verto_ctx *ctx, verto_ev *ev)
|
|
||||||
{
|
|
||||||
+ (void) ctx;
|
|
||||||
+ (void) ev;
|
|
||||||
+
|
|
||||||
freed = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
cb(verto_ctx *ctx, verto_ev *ev)
|
|
||||||
{
|
|
||||||
+ (void) ctx;
|
|
||||||
+ (void) ev;
|
|
||||||
+
|
|
||||||
exitstatus = verto_get_proc_status(ev);
|
|
||||||
}
|
|
||||||
|
|
||||||
diff --git a/tests/idle.c b/tests/idle.c
|
|
||||||
index f6b43b8..a0c6e48 100644
|
|
||||||
--- a/tests/idle.c
|
|
||||||
+++ b/tests/idle.c
|
|
||||||
@@ -29,6 +29,8 @@ static int callcount;
|
|
||||||
void
|
|
||||||
exit_cb(verto_ctx *ctx, verto_ev *ev)
|
|
||||||
{
|
|
||||||
+ (void) ctx;
|
|
||||||
+ (void) ev;
|
|
||||||
retval = 1;
|
|
||||||
switch (callcount) {
|
|
||||||
case 0:
|
|
||||||
@@ -55,6 +57,8 @@ exit_cb(verto_ctx *ctx, verto_ev *ev)
|
|
||||||
|
|
||||||
void
|
|
||||||
onfree(verto_ctx *ctx, verto_ev *ev) {
|
|
||||||
+ (void) ctx;
|
|
||||||
+ (void) ev;
|
|
||||||
++callcount;
|
|
||||||
}
|
|
||||||
|
|
||||||
diff --git a/tests/read.c b/tests/read.c
|
|
||||||
index 9d0bca5..51010d3 100644
|
|
||||||
--- a/tests/read.c
|
|
||||||
+++ b/tests/read.c
|
|
||||||
@@ -41,6 +41,8 @@ static int callcount = 0;
|
|
||||||
static void
|
|
||||||
timeout_cb(verto_ctx *ctx, verto_ev *ev)
|
|
||||||
{
|
|
||||||
+ (void) ev;
|
|
||||||
+
|
|
||||||
printf("ERROR: Timeout!\n");
|
|
||||||
if (fds[0] >= 0)
|
|
||||||
close(fds[0]);
|
|
||||||
diff --git a/tests/signal.c b/tests/signal.c
|
|
||||||
index 5a62ad1..47a723a 100644
|
|
||||||
--- a/tests/signal.c
|
|
||||||
+++ b/tests/signal.c
|
|
||||||
@@ -55,6 +55,9 @@ exit_cb(verto_ctx *ctx, verto_ev *ev)
|
|
||||||
void
|
|
||||||
cb(verto_ctx *ctx, verto_ev *ev)
|
|
||||||
{
|
|
||||||
+ (void) ctx;
|
|
||||||
+ (void) ev;
|
|
||||||
+
|
|
||||||
count++;
|
|
||||||
}
|
|
||||||
|
|
||||||
diff --git a/tests/test.h b/tests/test.h
|
|
||||||
index 56e3ffc..16111cf 100644
|
|
||||||
--- a/tests/test.h
|
|
||||||
+++ b/tests/test.h
|
|
||||||
@@ -27,6 +27,7 @@
|
|
||||||
#include <assert.h>
|
|
||||||
#include <signal.h>
|
|
||||||
#include <string.h>
|
|
||||||
+#include <unistd.h>
|
|
||||||
|
|
||||||
#include <verto.h>
|
|
||||||
|
|
||||||
diff --git a/tests/timeout.c b/tests/timeout.c
|
|
||||||
index 82ebd0a..4ecc45d 100644
|
|
||||||
--- a/tests/timeout.c
|
|
||||||
+++ b/tests/timeout.c
|
|
||||||
@@ -57,6 +57,7 @@ elapsed(time_t min, time_t max)
|
|
||||||
static void
|
|
||||||
exit_cb(verto_ctx *ctx, verto_ev *ev)
|
|
||||||
{
|
|
||||||
+ (void) ev;
|
|
||||||
assert(callcount == 3);
|
|
||||||
verto_break(ctx);
|
|
||||||
}
|
|
||||||
diff --git a/tests/write.c b/tests/write.c
|
|
||||||
index 0a2422c..deb59fc 100644
|
|
||||||
--- a/tests/write.c
|
|
||||||
+++ b/tests/write.c
|
|
||||||
@@ -41,6 +41,8 @@ static int callcount = 0;
|
|
||||||
static void
|
|
||||||
timeout_cb(verto_ctx *ctx, verto_ev *ev)
|
|
||||||
{
|
|
||||||
+ (void) ev;
|
|
||||||
+
|
|
||||||
printf("ERROR: Timeout!\n");
|
|
||||||
if (fds[0] >= 0)
|
|
||||||
close(fds[0]);
|
|
@ -1,56 +0,0 @@
|
|||||||
From 29585309bf479fe73c3be59e2f8371c3b6c4554a Mon Sep 17 00:00:00 2001
|
|
||||||
From: Tomas Kuthan <tkuthan@gmail.com>
|
|
||||||
Date: Mon, 7 Aug 2017 16:01:43 +0200
|
|
||||||
Subject: [PATCH] Fix memleak in libverto:vfree
|
|
||||||
|
|
||||||
verto_set_allocator(resize, hierarchical) has an unducumented
|
|
||||||
requirement on allocator function resize, that resize(ptr, 0) is
|
|
||||||
equivalent to free(ptr).
|
|
||||||
|
|
||||||
Some implementations of the default allocator realloc don't meet this
|
|
||||||
requirement. realloc(ptr, 0) may return a unique pointer that can be
|
|
||||||
successfully passed to free. This new pointer never gets freed and the
|
|
||||||
memory overhead leaks.
|
|
||||||
|
|
||||||
This fix replaces realloc(ptr, 0) with free(ptr) in vresize and
|
|
||||||
documents the allocator requirement.
|
|
||||||
|
|
||||||
[rharwood@redhat.com: Cleanup comments slightly]
|
|
||||||
Closes: #18
|
|
||||||
|
|
||||||
(cherry picked from commit 968d542e83619de9759ac4d8f13df30e1016b6c2)
|
|
||||||
---
|
|
||||||
src/verto.c | 5 +++++
|
|
||||||
src/verto.h | 3 ++-
|
|
||||||
2 files changed, 7 insertions(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/src/verto.c b/src/verto.c
|
|
||||||
index b98142d..da2ebc5 100644
|
|
||||||
--- a/src/verto.c
|
|
||||||
+++ b/src/verto.c
|
|
||||||
@@ -132,6 +132,11 @@ vresize(void *mem, size_t size)
|
|
||||||
{
|
|
||||||
if (!resize_cb)
|
|
||||||
resize_cb = &realloc;
|
|
||||||
+ if (size == 0 && resize_cb == &realloc) {
|
|
||||||
+ /* Avoid memleak as realloc(X, 0) can return a free-able pointer. */
|
|
||||||
+ free(mem);
|
|
||||||
+ return NULL;
|
|
||||||
+ }
|
|
||||||
return (*resize_cb)(mem, size);
|
|
||||||
}
|
|
||||||
|
|
||||||
diff --git a/src/verto.h b/src/verto.h
|
|
||||||
index 15fd81e..8000d2d 100644
|
|
||||||
--- a/src/verto.h
|
|
||||||
+++ b/src/verto.h
|
|
||||||
@@ -196,7 +196,8 @@ verto_set_default(const char *impl, verto_ev_type reqtypes);
|
|
||||||
* @see verto_add_idle()
|
|
||||||
* @see verto_add_signal()
|
|
||||||
* @see verto_add_child()
|
|
||||||
- * @param resize The allocator to use (behaves like realloc())
|
|
||||||
+ * @param resize The allocator to use (behaves like realloc();
|
|
||||||
+ * resize(ptr, 0) must free memory at ptr.)
|
|
||||||
* @param hierarchical Zero if the allocator is not hierarchical
|
|
||||||
*/
|
|
||||||
int
|
|
26
Work-around-libev-not-being-c89-compliant.patch
Normal file
26
Work-around-libev-not-being-c89-compliant.patch
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
From b6f0579cfd44a7e5b84b8239663a56f346acfc47 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Robbie Harwood <rharwood@redhat.com>
|
||||||
|
Date: Fri, 1 Sep 2017 15:59:49 -0400
|
||||||
|
Subject: [PATCH] Work around libev not being c89-compliant
|
||||||
|
|
||||||
|
(cherry picked from commit c57599d7039d2435c306830b2edae999c462befb)
|
||||||
|
[rharwood@redhat.com: Remove travis files]
|
||||||
|
---
|
||||||
|
configure.ac | 4 ++--
|
||||||
|
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/configure.ac b/configure.ac
|
||||||
|
index 09ee123..b7b5908 100644
|
||||||
|
--- a/configure.ac
|
||||||
|
+++ b/configure.ac
|
||||||
|
@@ -7,8 +7,8 @@ m4_ifdef([AC_USE_SYSTEM_EXTENSIONS],
|
||||||
|
[AC_USE_SYSTEM_EXTENSIONS],
|
||||||
|
[AC_GNU_SOURCE])
|
||||||
|
|
||||||
|
-AC_PROG_CC_C89
|
||||||
|
-for flag in -std=c89 -Wall -Wextra; do
|
||||||
|
+AC_PROG_CC_C99
|
||||||
|
+for flag in -Wall -Wextra; do
|
||||||
|
AC_TRY_COMPILE([], [return 0;], [CFLAGS="$CFLAGS $flag"],)
|
||||||
|
done
|
||||||
|
|
@ -1,18 +1,15 @@
|
|||||||
%global homepage https://github.com/latchset/libverto
|
%global homepage https://github.com/latchset/libverto
|
||||||
|
|
||||||
Name: libverto
|
Name: libverto
|
||||||
Version: 0.2.6
|
Version: 0.3.0
|
||||||
Release: 11%{?dist}
|
Release: 1%{?dist}
|
||||||
Summary: Main loop abstraction library
|
Summary: Main loop abstraction library
|
||||||
|
|
||||||
License: MIT
|
License: MIT
|
||||||
URL: %{homepage}
|
URL: %{homepage}
|
||||||
Source0: %{homepage}/releases/download/%{version}/%{name}-%{version}.tar.gz
|
Source0: %{homepage}/releases/download/%{version}/%{name}-%{version}.tar.gz
|
||||||
|
|
||||||
Patch0: Add-Travis-support.patch
|
Patch0: Work-around-libev-not-being-c89-compliant.patch
|
||||||
Patch1: Add-a-CI-target-for-clang.patch
|
|
||||||
Patch2: Enable-and-fix-all-warnings.patch
|
|
||||||
Patch3: Fix-memleak-in-libverto-vfree.patch
|
|
||||||
|
|
||||||
BuildRequires: autoconf
|
BuildRequires: autoconf
|
||||||
BuildRequires: automake
|
BuildRequires: automake
|
||||||
@ -206,6 +203,9 @@ find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} ';'
|
|||||||
%endif
|
%endif
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Sep 05 2017 Robbie Harwood <rharwood@redhat.com> - 0.3.0-1
|
||||||
|
- New upstream release (0.3.0)
|
||||||
|
|
||||||
* Mon Aug 07 2017 Robbie Harwood <rharwood@redhat.com> - 0.2.6-11
|
* Mon Aug 07 2017 Robbie Harwood <rharwood@redhat.com> - 0.2.6-11
|
||||||
- Fix memleak in vfree()
|
- Fix memleak in vfree()
|
||||||
- Misc spec file fixes
|
- Misc spec file fixes
|
||||||
|
Loading…
Reference in New Issue
Block a user