[libvirt] [PATCH] libvirtd: Better initscript error reporting

Eric Blake eblake at redhat.com
Wed Feb 24 18:17:30 UTC 2010


According to Cole Robinson on 2/24/2010 10:55 AM:
>>From time to time I bork my install, and hate it when the initscript
> returns no info. This patch makes things a bit more clear.
> 
> +LIBVIRTD_BIN="@sbindir@/libvirtd"
> +
>  # Sanity checks.
> -[ -x @sbindir@/libvirtd ] || exit 0
> +[ ! -e $LIBVIRTD_BIN ] && echo "$LIBVIRTD_BIN not found." && exit 1

Why the switch from -x to -e?  If libvirtd is missing executable
permissions, it can now get through this check whereas before it exited early.

Group the failure, in case echo also fails (such as for a full disk);
also, I'm used to not seeing trailing . on error messages, but it is
polite to attribute who's printing the failure.  Printing to stderr is
also nice.  Something like:

[...] && { echo "$0: $LIBVIRTD_BIN not found" 2>&1; exit 1; }

-- 
Eric Blake   eblake at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 320 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20100224/65b4111f/attachment-0001.sig>


More information about the libvir-list mailing list