diff options
Diffstat (limited to 'java')
-rw-r--r-- | java/javavmwrapper/src/javavmwrapper.sh | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/java/javavmwrapper/src/javavmwrapper.sh b/java/javavmwrapper/src/javavmwrapper.sh index 7113b252600d..81497379248e 100644 --- a/java/javavmwrapper/src/javavmwrapper.sh +++ b/java/javavmwrapper/src/javavmwrapper.sh @@ -72,10 +72,12 @@ createJavaLinks () { # Sort the configuration file # sortConfiguration () { + # Ensure the configuration file exists if [ ! -f "${CONF}" ]; then return fi + # Ensure the configuration file has the correct permissions if [ ! -w "${CONF}" -o ! -r "${CONF}" ]; then echo "${IAM}: error: can't read/write ${CONF} configuration file!" >&2 return @@ -271,6 +273,12 @@ registerVM () { touch "${CONF}" fi + # Ensure the configuration file exists and has the correct permissions + if [ ! -f "${CONF}" -o ! -w "${CONF}" -o ! -r "${CONF}" ]; then + echo "${IAM}: error: can't read/write ${CONF} configuration file!" 1>&2 + exit 1 + fi + # Check that the given VM can be found in the configuration file VM=`echo "${1}" | sed -E 's|[[:space:]]*#.*||' 2>/dev/null` REGISTERED= @@ -333,6 +341,12 @@ unregisterVM () { exit 1 fi + # Ensure the configuration file has the correct permissions + if [ ! -w "${CONF}" -o ! -r "${CONF}" ]; then + echo "${IAM}: error: can't read/write ${CONF} configuration file!" >&2 + exit 1 + fi + # Check that the given VM can be found in the configuration file if [ -z "`grep "${1}" "${CONF}"`" ]; then echo "${IAM}: error: \"${1}\" JavaVM is not currently registered" |