On 4/1/21 11:06 PM, Bruce Dubbs wrote:
On 4/1/21 7:15 PM, Scott Andrews wrote:

in init-functions start_daemon pidfile is not validated before removing...

code as follows........

[snip]

     # Execute
     if [ -z "${force}" ]; then
         if [ -z "${pidfile}" ]; then
             # Determine the pid by discovery
             pidlist=`pidofproc "${1}"`
             retval="${?}"

            ^^^^^^^^^^^^^^^^^^

            needs to set pidfile here otherwise rm -f "${pidfile}" fails below

rm -f anything

will never fail unless it is a directory or there are permission problems.

-f, --force
           ignore nonexistent files and arguments, never prompt



That isn't the point,  the script is going to remove any file passed to the function with the -p <filespec> argument.

It will also execute rm -f "" everytime it is run without passing -p <filespec> and the daemon is not running as pidfile is always unset without passing -p <filespec>


            1)
                # Program is not running, but an invalid pid file exists
                # remove the pid file and continue
                rm -f "${pidfile}"


Maybe you don't care but I care about correctness.

The boot scripts also spawn many subshells where that just isn't necessary.

Use the bash builtins, that is what they are there for.


--
http://lists.linuxfromscratch.org/listinfo/lfs-support
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page

Do not top post on this list.

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

http://en.wikipedia.org/wiki/Posting_style

Reply via email to