safe_asterisk: Don't automatically exceed MAXFILES value of 2^20.

On systems with lots of RAM (e.g. 24GB) /proc/sys/fs/file-max divided
by two can exceed the per-process file limit of 2^20. This patch
ensures the value is capped.

(Patch cleaned up by me.)

ASTERISK-24011 #close
Reported by: Michael Myles
Patches:
  safe_asterisk-ulimit.diff uploaded by Michael Myles (License #6626)
........

Merged revisions 424875 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 424878 from http://svn.asterisk.org/svn/asterisk/branches/11


git-svn-id: http://svn.asterisk.org/svn/asterisk/branches/12@424879 f38db490-d61c-443f-a65b-d21fe96a405b