From: Nicolas Thill Date: Fri, 10 Apr 2009 12:15:57 +0000 (+0000) Subject: remove uneeded daemon/pthread workarounds after [15193] X-Git-Url: http://git.openwrt.org/?a=commitdiff_plain;h=58925f0a573db1f5918aa5415564c676ef51d277;p=openwrt%2Fsvn-archive%2Fpackages.git remove uneeded daemon/pthread workarounds after [15193] SVN-Revision: 15194 --- diff --git a/net/asterisk-1.4.x/patches/035-main-asterisk-uclibc-daemon.patch b/net/asterisk-1.4.x/patches/035-main-asterisk-uclibc-daemon.patch deleted file mode 100644 index 82159d495..000000000 --- a/net/asterisk-1.4.x/patches/035-main-asterisk-uclibc-daemon.patch +++ /dev/null @@ -1,44 +0,0 @@ -diff -Nru asterisk-1.4.23.1.org/main/asterisk.c asterisk-1.4.23.1/main/asterisk.c ---- asterisk-1.4.23.1.org/main/asterisk.c 2008-12-23 16:35:38.000000000 +0100 -+++ asterisk-1.4.23.1/main/asterisk.c 2009-01-31 15:41:40.000000000 +0100 -@@ -2986,9 +2986,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/net/asterisk-1.6.x/patches/200-uclibc-daemon.patch b/net/asterisk-1.6.x/patches/200-uclibc-daemon.patch deleted file mode 100644 index 4956791d4..000000000 --- a/net/asterisk-1.6.x/patches/200-uclibc-daemon.patch +++ /dev/null @@ -1,44 +0,0 @@ -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);