aboutsummaryrefslogtreecommitdiffstats
path: root/testing/motion
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2014-05-16 14:53:43 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2014-05-16 14:54:14 +0000
commitfb23dc2bdafa793b62348813297aa29c563556d9 (patch)
tree78bad5b79c8a0d8c76bdac6bcddd70280006fb9d /testing/motion
parent7d3675c98f4433dd1248815e52f2a4fc9d80918a (diff)
downloadaports-fb23dc2bdafa793b62348813297aa29c563556d9.tar.bz2
aports-fb23dc2bdafa793b62348813297aa29c563556d9.tar.xz
main/motion: fix various segfaults
Diffstat (limited to 'testing/motion')
-rw-r--r--testing/motion/APKBUILD27
-rw-r--r--testing/motion/get_current_dir_name.patch46
-rw-r--r--testing/motion/pthread_key_create.patch53
3 files changed, 121 insertions, 5 deletions
diff --git a/testing/motion/APKBUILD b/testing/motion/APKBUILD
index 731ae5ad83..48f39eb921 100644
--- a/testing/motion/APKBUILD
+++ b/testing/motion/APKBUILD
@@ -2,7 +2,7 @@
# Maintainer: Mika Havela <mika.havela@gmail.com>
pkgname=motion
pkgver=3.2.12
-pkgrel=0
+pkgrel=1
pkgdesc="Detect if a significant part of the picture has changed (e.g. from a webcam)."
url="http://www.lavrsen.dk/foswiki/bin/view/Motion/WebHome"
arch="all"
@@ -15,9 +15,12 @@ makedepends="$depends_dev bash jpeg-dev v4l-utils-dev" # Add ffmpeg-dev (when m
install="$pkgname.pre-install"
subpackages="$pkgname-doc"
source="http://downloads.sourceforge.net/$pkgname/$pkgname-$pkgver.tar.gz
-motion.confd
-motion.initd
-motion-dist.conf.in.patch"
+ motion.confd
+ motion.initd
+ motion-dist.conf.in.patch
+ pthread_key_create.patch
+ get_current_dir_name.patch
+ "
_builddir="$srcdir"/$pkgname-$pkgver
prepare() {
@@ -53,4 +56,18 @@ package() {
md5sums="1ba0065ed50509aaffb171594c689f46 motion-3.2.12.tar.gz
c444bfd48ac8d6272d5191836ceb544a motion.confd
3acfe162df3fec28c88c1688e7385189 motion.initd
-2ee4fa214987e7643025732f016e9296 motion-dist.conf.in.patch"
+2ee4fa214987e7643025732f016e9296 motion-dist.conf.in.patch
+1eca97b280069ad0f1d5cb9946145907 pthread_key_create.patch
+bd58201a2d4724457b668fb65f7b17c3 get_current_dir_name.patch"
+sha256sums="a597f8d7ec0bf3c5fb62722c4eead59717fe01c2ae0d256c642027cea74b2f0a motion-3.2.12.tar.gz
+a89d6b9b070d9447694a3acb9c20768bf232ff37d45728aee7f972f5a0a2b855 motion.confd
+f65843332b1d342058fcb96f139d2334105a009af10692f4dd619d4ccf63eb85 motion.initd
+f164f1c290734378823559bb3f643316f8da8eb61d6fe720761ad4f369a6a074 motion-dist.conf.in.patch
+7658950a54363b8aa8090c508f3864f2e15af9def10bdc96f18cdac7cb141ef0 pthread_key_create.patch
+8cdf811aa274f08c02bd0b3e67548d337f1472d1a9c041c129deeb15ab74fa7d get_current_dir_name.patch"
+sha512sums="d44620f8865420da71ff1dc1e1d8ba8e5465b395f2cf3b2cc9a91d3d415694b26376a9f8e3a1b78ffd0efde22d9e0338daa77237aed38c060dc3577af4c0864c motion-3.2.12.tar.gz
+37821907f3b974675be2584460f499e83c3745ee70fa4674e82186fa9f9c04346e3d4a83a0eb3133bdb33ecee169bf590f6d3eda45ef54958f8babdce446ea08 motion.confd
+a589e56929a5091c1e398f81b9f1744f393006b429a27e5b7227326e3afc4dd792e30486d66f608208eec18e7062e14f673493aafd55a5fed9d33d160bc723a0 motion.initd
+f45fb8f95b7b336b72acf04b29f30413fae1d247d3ad430c36862475ce3148e210d3feb390dc898a369470da20c16c2d26fd018dcb9a7cfe1e4e9c95a46d0f75 motion-dist.conf.in.patch
+17da7b1d2c15b5f95246e8c8f88ff82c090110a950f41d02c55840265d46b8838511602f4da489c16b0e31a1b346345a208994b529064771a37e436ad49650e9 pthread_key_create.patch
+c1d11dd378673f85db290a1d181b7aa454baac7d6ed77a46cdc24cc83c1fc708bafbd76d851767256b797dae4d2032efecbd6e66ffe532b8fda61d2d920b7d58 get_current_dir_name.patch"
diff --git a/testing/motion/get_current_dir_name.patch b/testing/motion/get_current_dir_name.patch
new file mode 100644
index 0000000000..d7e3816c2f
--- /dev/null
+++ b/testing/motion/get_current_dir_name.patch
@@ -0,0 +1,46 @@
+The check for get_current_dir_name appears to be broken. you need
+set _GNU_SOURCE for it.
+
+But that triggered other issue with broken ifdefs so we simply avoid
+using get_current_dir_name alltogether.
+
+--- ./conf.c.orig
++++ ./conf.c
+@@ -32,16 +32,6 @@
+ #include "video.h"
+ #endif /* BSD */
+
+-#ifndef HAVE_GET_CURRENT_DIR_NAME
+-char *get_current_dir_name(void)
+-{
+- char *buf = malloc(MAXPATHLEN);
+- getwd(buf);
+- return buf;
+-}
+-#endif
+-
+-
+ #define stripnewline(x) {if ((x)[strlen(x)-1]=='\n') (x)[strlen(x) - 1] = 0;}
+
+
+@@ -1645,18 +1635,17 @@
+ }
+
+ if (!fp) { /* Commandline didn't work, try current dir */
+- char *path = NULL;
++ char path[PATH_MAX];
+ if (cnt[0]->conf_filename[0])
+ motion_log(-1, 1, "Configfile %s not found - trying defaults.", filename);
+
+- if ((path = get_current_dir_name()) == NULL) {
++ if (getcwd(path, PATH_MAX) == NULL) {
+ motion_log(LOG_ERR, 1, "Error get_current_dir_name");
+ exit(-1);
+ }
+
+ snprintf(filename, PATH_MAX, "%s/motion.conf", path);
+ fp = fopen (filename, "r");
+- free(path);
+ }
+
+ if (!fp) { /* specified file does not exist... try default file */
diff --git a/testing/motion/pthread_key_create.patch b/testing/motion/pthread_key_create.patch
new file mode 100644
index 0000000000..afedce75b5
--- /dev/null
+++ b/testing/motion/pthread_key_create.patch
@@ -0,0 +1,53 @@
+make sure we create the tls key before we access in any way.
+
+we also fix the check for broken glibc strerror_r
+
+--- ./motion.c.orig
++++ ./motion.c
+@@ -2267,6 +2267,9 @@
+ struct sigaction sigchild_action;
+ setup_signals(&sig_handler_action, &sigchild_action);
+
++ /* Create the TLS key for thread number. */
++ pthread_key_create(&tls_key_threadnr, NULL);
++
+ motion_startup(1, argc, argv);
+
+ #ifdef HAVE_FFMPEG
+@@ -2290,9 +2293,6 @@
+ pthread_attr_init(&thread_attr);
+ pthread_attr_setdetachstate(&thread_attr, PTHREAD_CREATE_DETACHED);
+
+- /* Create the TLS key for thread number. */
+- pthread_key_create(&tls_key_threadnr, NULL);
+-
+ do {
+ if (restart) {
+ /* Handle the restart situation. Currently the approach is to
+@@ -2745,9 +2745,6 @@
+ {
+ int errno_save, n;
+ char buf[1024];
+-#if (!defined(BSD)) && (!(_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && ! _GNU_SOURCE)
+- char msg_buf[100];
+-#endif
+ va_list ap;
+ int threadnr;
+
+@@ -2780,12 +2778,13 @@
+ * version of strerror_r, which doesn't actually put the message into
+ * my buffer :-(. I have put in a 'hack' to get around this.
+ */
+-#if (defined(BSD))
+- strerror_r(errno_save, buf + n, sizeof(buf) - n); /* 2 for the ': ' */
+-#elif (_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && ! _GNU_SOURCE
++#if !defined(__GLIBC__) || ((_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && ! defined(_GNU_SOURCE))
+ strerror_r(errno_save, buf + n, sizeof(buf) - n);
+ #else
++ {
++ char msg_buf[100];
+ strncat(buf, strerror_r(errno_save, msg_buf, sizeof(msg_buf)), 1024 - strlen(buf));
++ }
+ #endif
+ }
+ /* If 'level' is not negative, send the message to the syslog */