Author: gjb
Date: Tue Feb 10 12:04:38 2015
New Revision: 278502
URL: https://svnweb.freebsd.org/changeset/base/278502

Log:
  In scripts/mk-vmimage.sh, prevent incorrect usage() by
  defaulting VMCONFIG to /dev/null, and additionally
  ensuring VMCONFIG is not a character device before it
  is sourced.
  
  While here, be sure to exit if usage() is called.
  
  This should effectively be no-op, but the usage() output
  was discovered while investigating a larger issue.
  
  MFC after:    1 week
  X-MFC-with:   r277458, r277536, r277606, r277609,
                r277836, r278118, r278119, r278206
  Sponsored by: The FreeBSD Foundation

Modified:
  head/release/scripts/mk-vmimage.sh

Modified: head/release/scripts/mk-vmimage.sh
==============================================================================
--- head/release/scripts/mk-vmimage.sh  Tue Feb 10 11:47:03 2015        
(r278501)
+++ head/release/scripts/mk-vmimage.sh  Tue Feb 10 12:04:38 2015        
(r278502)
@@ -40,6 +40,7 @@ usage() {
 
 main() {
        local arg
+       VMCONFIG="/dev/null"
        while getopts "C:c:d:f:i:o:s:S:" arg; do
                case "${arg}" in
                        C)
@@ -76,10 +77,9 @@ main() {
                -z "${WORLDDIR}" -o \
                -z "${DESTDIR}" -o \
                -z "${VMSIZE}" -o \
-               -z "${VMIMAGE}" -o \
-               -z "${VMCONFIG}" ];
+               -z "${VMIMAGE}" ];
        then
-               usage
+               usage || exit 0
        fi
 
        if [ -z "${VMBUILDCONF}" ] || [ ! -e "${VMBUILDCONF}" ]; then
@@ -89,7 +89,7 @@ main() {
 
        . "${VMBUILDCONF}"
 
-       if [ ! -z "${VMCONFIG}" ] && [ -e "${VMCONFIG}" ]; then
+       if [ ! -z "${VMCONFIG}" ] && [ ! -c "${VMCONFIG}" ]; then
                . "${VMCONFIG}"
        fi
 
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to