]> git.pld-linux.org Git - packages/rc-scripts.git/blob - rc-scripts-ulimits.patch
- typo
[packages/rc-scripts.git] / rc-scripts-ulimits.patch
1 diff -Nur rc-scripts-0.4.0.2.orig/rc.d/init.d/functions rc-scripts-0.4.0.2/rc.d/init.d/functions
2 --- rc-scripts-0.4.0.2.orig/rc.d/init.d/functions       2003-10-02 20:46:49.000000000 +0200
3 +++ rc-scripts-0.4.0.2/rc.d/init.d/functions    2003-10-12 15:50:17.035580952 +0200
4 @@ -263,13 +263,18 @@
5         return $exit_code
6  }
7  
8 -# A function to start a program (now it's usefull on read-only filesystem too)
9 +# A function to start a program (now it's useful on read-only filesystem too)
10  daemon()
11  {
12 -       typeset errors="" prog=""
13 +       typeset errors="" prog="" limits=""
14         typeset -i exit_code=0
15         [ -z "$DEFAULT_SERVICE_RUN_NICE_LEVEL" ] && DEFAULT_SERVICE_RUN_NICE_LEVEL=0
16 -       # Test syntax. Don't use -o instead || here - this will broke ksh --misiek
17 +       # "-u unlimited" (-p for ksh) to make sure daemons will be able to fork.
18 +       # "-c 0" to make sure it doesn't core dump anywhere; while this could mask
19 +       # problems with the daemon, it also closes some security problems.
20 +       # Users' limits are set via pam_limits.
21 +       [ -z "$DEFAULT_SERVICE_LIMITS" ] && DEFAULT_SERVICE_LIMITS_HARD="-u unlimited -c 0"
22 +       # Test syntax. Don't use -o instead || here - this will break ksh --misiek
23         while [ "$1" != "${1##-}" ] || [ "$1" != "${1##+}" ]; do
24                 case $1 in
25                   '')
26 @@ -299,20 +304,18 @@
27                 prog="$prog $*"
28         fi
29  
30 -       # make sure it doesn't core dump anywhere; while this could mask
31 -       # problems with the daemon, it also closes some security problems
32 -       ulimit -c 0
33 -
34 -       # Make sure daemons will be able to fork.
35 -       # Limits are set via pam_limits.
36         if [ -n "$KSH_VERSION" ]; then
37 -               ulimit -p unlimited
38 +               limits="`echo ${SERVICE_LIMITS:-$DEFAULT_SERVICE_LIMITS} | sed -e 's/-\([SH]\?\)u/-\1p/'`"
39         elif [ -n "$ZSH_VERSION" ]; then
40 -               ulimit -u unlimited
41 +               limits="${SERVICE_LIMITS:-$DEFAULT_SERVICE_LIMITS}"
42         elif [ -n "$BASH_VERSION" ]; then
43 -               ulimit -u unlimited
44 +               limits="${SERVICE_LIMITS:-$DEFAULT_SERVICE_LIMITS}"
45  #      elif [ -n "`$SH -c 'echo ${.sh.version}' 2>/dev/null`" ]; then
46         fi
47 +       while echo "$limits" | grep -q '[^ ]'; do
48 +               ulimit `echo ${limits} | sed -e 's/^ *\(-[^-]*\)\(-.*\)\?$/\1/'`
49 +               limits="`echo ${limits} | sed -e 's/^ *\(-[^-]*\)\(-.*\)\?$/\2/'`"
50 +       done
51  
52         # And start it up.
53         busy
54 diff -Nur rc-scripts-0.4.0.2.orig/sysconfig/system rc-scripts-0.4.0.2/sysconfig/system
55 --- rc-scripts-0.4.0.2.orig/sysconfig/system    2003-10-02 20:46:49.000000000 +0200
56 +++ rc-scripts-0.4.0.2/sysconfig/system 2003-10-12 15:50:53.502037208 +0200
57 @@ -17,6 +17,17 @@
58  # $SERVICE_RUN_NICE_LEVEL is not defined in /etc/sysconfig/<service>
59  DEFAULT_SERVICE_RUN_NICE_LEVEL=0
60  
61 +# Default limits set before running demons (hard and soft) if
62 +# $SERVICE_LIMITS are not defined in /etc/sysconfig/<service>
63 +# Use "-u" for process limits (automatically translated to "-p" for ksh).
64 +# Use "-Sx" or "-Hx" to set only soft or hard "x" limit.
65 +# Advised limits are:
66 +# "-u unlimited" to make sure daemons will be able to fork;
67 +# "-c 0" to make sure it doesn't core dump anywhere; while this could mask
68 +# problems with the daemon, it also closes some security problems;
69 +# users' limits are set via pam_limits.
70 +DEFAULT_SERVICE_LIMITS="-u unlimited -c 0"
71 +
72  # Setup PNP using userspace tools?
73  RUN_USERPNP=yes
74  # Setup kernel space PNP (2.4.x)
This page took 0.054532 seconds and 3 git commands to generate.