Snow Leopard 10.6.5 and apachectl

I just upgraded to 10.6.5 and noticed that apachectl stops working properly. When I run apacheclt now it gives me this error:

/usr/sbin/apachectl: line 82: ulimit: open files: cannot modify limit: Invalid argument

The problem seems to be with the ULIMIT variable in the shell script:

ULIMIT_MAX_FILES="ulimit -S -n `ulimit -H -n`"

I think the problem is that ulimit returns “unlimited” which cannot be used in the command ulimit -S -n, so I just changed the ULIMIT back to what it was before upgrading to 10.6.5: