diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2009-04-16 13:07:34 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2009-04-16 13:07:34 +0000 |
commit | a19bdc166f30a1f83b7777bff0722d18b0e2ff4b (patch) | |
tree | 927ee722dd92d290759b5e707acd5a1ff50acc70 | |
parent | 7037911e4f49b8f952fadae49587605c14f9f1d5 (diff) | |
download | aports-a19bdc166f30a1f83b7777bff0722d18b0e2ff4b.tar.bz2 aports-a19bdc166f30a1f83b7777bff0722d18b0e2ff4b.tar.xz |
testing/asterisk: fix for asterisk daemon
found here:
https://dev.openwrt.org/browser/packages/net/asterisk-1.6.x/patches/200-uclibc-daemon.patch?rev=14304
-rw-r--r-- | testing/asterisk/200-uclibc-daemon.patch | 44 | ||||
-rw-r--r-- | testing/asterisk/APKBUILD | 15 |
2 files changed, 53 insertions, 6 deletions
diff --git a/testing/asterisk/200-uclibc-daemon.patch b/testing/asterisk/200-uclibc-daemon.patch new file mode 100644 index 000000000..4956791d4 --- /dev/null +++ b/testing/asterisk/200-uclibc-daemon.patch @@ -0,0 +1,44 @@ +diff -Nru asterisk-1.6.1-beta4.org/main/asterisk.c asterisk-1.6.1-beta4/main/asterisk.c +--- asterisk-1.6.1-beta4.org/main/asterisk.c 2008-12-12 23:05:58.000000000 +0100 ++++ asterisk-1.6.1-beta4/main/asterisk.c 2008-12-23 15:28:21.000000000 +0100 +@@ -3295,9 +3295,40 @@ + #if HAVE_WORKING_FORK + if (ast_opt_always_fork || !ast_opt_no_fork) { + #ifndef HAVE_SBIN_LAUNCHD ++#ifndef __UCLIBC__ + if (daemon(1, 0) < 0) { + ast_log(LOG_ERROR, "daemon() failed: %s\n", strerror(errno)); + } ++#else ++ /* ++ * workaround for uClibc-0.9.29 mipsel bug: ++ * recursive mutexes do not work if uClibc daemon() function has been called, ++ * if parent thread locks a mutex ++ * the child thread cannot acquire a lock with the same name ++ * (same code works if daemon() is not called) ++ * but duplication of uClibc daemon.c code in here does work. ++ */ ++ int fd; ++ switch (fork()) { ++ case -1: ++ exit(1); ++ case 0: ++ break; ++ default: ++ _exit(0); ++ } ++ if (setsid() == -1) ++ exit(1); ++ if (fork()) ++ _exit(0); ++ if ((fd = open("/dev/null", O_RDWR, 0)) != -1) { ++ dup2(fd, STDIN_FILENO); ++ dup2(fd, STDOUT_FILENO); ++ dup2(fd, STDERR_FILENO); ++ if (fd > 2) ++ close(fd); ++ } ++#endif + ast_mainpid = getpid(); + /* Blindly re-write pid file since we are forking */ + unlink(ast_config_AST_PID); diff --git a/testing/asterisk/APKBUILD b/testing/asterisk/APKBUILD index 39fde65ac..f495c00af 100644 --- a/testing/asterisk/APKBUILD +++ b/testing/asterisk/APKBUILD @@ -1,17 +1,18 @@ # Contributor: Timo Teras <timo.teras@iki.fi> # Maintainer: Timo Teras <timo.teras@iki.fi> pkgname=asterisk -pkgver=1.6.2.0-beta1 -pkgrel=1 +pkgver=1.6.2.0_beta1 +_myver=1.6.2.0-beta1 +pkgrel=3 pkgdesc="Asterisk: A Module Open Source PBX System" url="http://www.asterisk.org/" license="GPL" -depends="ncurses popt zlib newt dahdi-linux dahdi-tools libltdl" +depends="ncurses popt zlib newt dahdi-linux dahdi-tools libltdl libpri" makedepends="autoconf automake libtool ncurses-dev popt-dev newt-dev zlib-dev postgresql-dev unixodbc-dev dahdi-tools-dev libpri-dev g++ tar" install="$pkgname.pre-install $pkgname.post-install" subpackages="$pkgname-dev $pkgname-doc $pkgname-pgsql $pkgname-odbc" -source="http://downloads.digium.com/pub/asterisk/releases/$pkgname-$pkgver.tar.gz +source="http://downloads.digium.com/pub/asterisk/releases/$pkgname-$_myver.tar.gz asterisk-01-1.6.0-gsm-pic.patch asterisk-02-1.6.0-uclibc.patch asterisk-03-1.6.2.0-beta1-to-r186562.patch @@ -19,13 +20,14 @@ source="http://downloads.digium.com/pub/asterisk/releases/$pkgname-$pkgver.tar.g asterisk-05-1.6.1-glob-uclibc.patch asterisk-06-overlapped-enum.patch asterisk-07-issue14068.patch + 200-uclibc-daemon.patch asterisk.pre-install asterisk.post-install asterisk.initd asterisk.confd" build() { - cd "$srcdir/$pkgname-$pkgver" + cd "$srcdir/$pkgname-$_myver" for i in ../*.patch; do msg "Apply $i" patch -p1 < $i || return 1 @@ -87,7 +89,8 @@ md5sums="1a44f295fc9e72d19da7f42d095e6c60 asterisk-1.6.2.0-beta1.tar.gz c37928e95ebef36aad097accfdbbfcb8 asterisk-05-1.6.1-glob-uclibc.patch 1b49f980e56dc7ce493a046eadff3545 asterisk-06-overlapped-enum.patch 95bdc48553cc18c9d3807ac96956fc8a asterisk-07-issue14068.patch +b00c9d98ce2ad445501248a197c6e436 200-uclibc-daemon.patch b4a97cb1ec3cc3f71a10ce8c067ab430 asterisk.pre-install -2188be223f93923e04a8e812cf54e97c asterisk.post-install +62ecffc90b6714b85f377d1fac73c58b asterisk.post-install bbcd152417bb7c838b25cb6007db91da asterisk.initd ed31d7ba37bcf8b0346dcf8593c395f0 asterisk.confd" |