From 43c83759da1a41ec82d5ab24f60bf82d94e71ebb Mon Sep 17 00:00:00 2001 From: sthen Date: Mon, 7 Jun 2010 20:03:55 +0000 Subject: [PATCH] Don't ulimit -n $MAXFILES if $MAXFILES is undefined. Spotted by fgsch@ --- telephony/asterisk/Makefile | 6 ++-- .../patch-contrib_scripts_safe_asterisk | 34 +++++++++++++++---- 2 files changed, 31 insertions(+), 9 deletions(-) diff --git a/telephony/asterisk/Makefile b/telephony/asterisk/Makefile index 6d5b084d2be..a3f5b93fd7a 100644 --- a/telephony/asterisk/Makefile +++ b/telephony/asterisk/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.86 2010/06/02 13:18:56 sthen Exp $ +# $OpenBSD: Makefile,v 1.87 2010/06/07 20:03:55 sthen Exp $ SHARED_ONLY= Yes COMMENT-main= open source multi-protocol PBX and telephony toolkit @@ -6,8 +6,8 @@ COMMENT-main= open source multi-protocol PBX and telephony toolkit VER= 1.6.2.8 CORESOUNDS= 1.4.18 DISTNAME= asterisk-${VER:S/rc/-rc/} -# XXX if bumping, see FULLPKGNAME overrides below. -PKGNAME-main= asterisk-${VER} +# XXX if bumping subpackages, override FULLPKGNAME +PKGNAME-main= asterisk-${VER}p0 CATEGORIES= telephony diff --git a/telephony/asterisk/patches/patch-contrib_scripts_safe_asterisk b/telephony/asterisk/patches/patch-contrib_scripts_safe_asterisk index 84ee4ad1094..42405b93eb7 100644 --- a/telephony/asterisk/patches/patch-contrib_scripts_safe_asterisk +++ b/telephony/asterisk/patches/patch-contrib_scripts_safe_asterisk @@ -1,10 +1,10 @@ -$OpenBSD: patch-contrib_scripts_safe_asterisk,v 1.11 2010/04/08 16:18:00 sthen Exp $ +$OpenBSD: patch-contrib_scripts_safe_asterisk,v 1.12 2010/06/07 20:03:55 sthen Exp $ - more useful defaults - create /var/run/asterisk with sane ownership/perms --- contrib/scripts/safe_asterisk.orig Tue Jan 12 03:25:20 2010 -+++ contrib/scripts/safe_asterisk Fri Apr 2 00:55:43 2010 ++++ contrib/scripts/safe_asterisk Mon Jun 7 17:32:16 2010 @@ -2,9 +2,9 @@ # vim:textwidth=80:tabstop=4:shiftwidth=4:smartindent:autoindent @@ -32,11 +32,10 @@ $OpenBSD: patch-contrib_scripts_safe_asterisk,v 1.11 2010/04/08 16:18:00 sthen E # run asterisk with this priority PRIORITY=0 -@@ -42,6 +43,19 @@ message() { - echo "safe_asterisk[$$]: $1" >> "$LOGFILE" +@@ -43,6 +44,19 @@ message() { fi } -+ + +# Create the directory for the control socket if required. As of 1.6.0.26, +# Asterisk tries to create this itself at startup but doesn't give suitable +# ownership. This must be created before the 'check if asterisk is already @@ -49,6 +48,29 @@ $OpenBSD: patch-contrib_scripts_safe_asterisk,v 1.11 2010/04/08 16:18:00 sthen E + chmod 770 $varrundir + fi +fi - ++ # Check if Asterisk is already running. If it is, then bug out, because # starting safe_asterisk when Asterisk is running is very bad. + VERSION=`${ASTSBINDIR}/asterisk -rx 'core show version'` +@@ -71,7 +85,7 @@ else + fi + fi + SYSCTL_MAXFILES="fs.file-max" +- elif `uname -s | grep Darwin /dev/null 2>&1`; then ++ elif `uname -s | grep -E '(BSD|Darwin)' /dev/null 2>&1`; then + SYSCTL_MAXFILES="kern.maxfiles" + fi + +@@ -82,8 +96,10 @@ else + fi + fi + +- # set the process's filemax to whatever set above +- ulimit -n $MAXFILES ++ if ! test "x$MAXFILES" = "x" ; then ++ # set the process's filemax to whatever set above ++ ulimit -n $MAXFILES ++ fi + + if test ! -d ${ASTVARRUNDIR} ; then + mkdir -p ${ASTVARRUNDIR}