[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Dropping the if clause in (INITCTL=/run/initctl; if [ "$INITCTL" ])



On Sat, Feb 11, 2012 at 03:46:50PM -0800, Regid Ichira wrote:
> $ grep -nA13 ^INITCTL= /var/lib/dpkg/info/sysvinit.postinst
> 19:INITCTL=/run/initctl
> 20-case "$(uname -s)" in
> 21-  *FreeBSD)
> 22-     OLDINITCTL=/etc/.initctl
> 23-     ;;
> 24-  *)
> 25-     OLDINITCTL=/dev/initctl
> 26-     ;;
> 27-esac
> 28-
> 29-# Create /run/initctl if not present, and also create compatibility
> 30-# symlinks
> 31-if [ "$INITCTL" ] && [ ! -p "$INITCTL" ]
> 32-then
> $
> 
>   In line #19, INITCTL was set to /run/initctl.  What is the reson to
> test for [ "$INITCTL" ] in line #31?  I mean, isn't
> 
>     if [ ! -p "$INITCTL" ]
> 
> somewhat better?

Yes, but it's there for some historical reason, and because in the
past INITCTL could also be set to "" under some circumstances.  The
logic has been kept--if the code is changed again in the future, it
will avoid breakage if INITCTL is unset.


Regards,
Roger

-- 
  .''`.  Roger Leigh
 : :' :  Debian GNU/Linux             http://people.debian.org/~rleigh/
 `. `'   Printing on GNU/Linux?       http://gutenprint.sourceforge.net/
   `-    GPG Public Key: 0x25BFB848   Please GPG sign your mail.


Reply to: