Skip to content

Commit

Permalink
Minor improvement to save_file_hash()
Browse files Browse the repository at this point in the history
Signed-off-by: Richard T Bonhomme <[email protected]>
  • Loading branch information
TinCanTech committed Mar 1, 2022
1 parent 8f7d3d9 commit 191679b
Showing 1 changed file with 14 additions and 15 deletions.
29 changes: 14 additions & 15 deletions easytls
Original file line number Diff line number Diff line change
Expand Up @@ -1710,25 +1710,24 @@ save_file_hash ()
valid_hash="${2}" # hash to save

# Must be a valid target fle
unset -v valid_target
[ "${hash_file}" = "${EASYTLS_FASTER_HASH}" ] && valid_target=1
[ "${hash_file}" = "${EASYTLS_CONFIG_HASH}" ] && valid_target=1
[ "${hash_file}" = "${EASYTLS_INLINE_X_HASH}" ] && valid_target=1
[ "${hash_file}" = "${EASYTLS_KEY_X_HASH}" ] && valid_target=1
[ "${hash_file}" = "${EASYTLS_DISABLED_HASH}" ] && valid_target=1
[ -n "${valid_target}" ] || {
if [ "${hash_file}" = "${EASYTLS_FASTER_HASH}" ] || \
[ "${hash_file}" = "${EASYTLS_CONFIG_HASH}" ] || \
[ "${hash_file}" = "${EASYTLS_INLINE_X_HASH}" ] || \
[ "${hash_file}" = "${EASYTLS_KEY_X_HASH}" ] || \
[ "${hash_file}" = "${EASYTLS_DISABLED_HASH}" ]; then

# Save hash to target
"${EASYTLS_PRINTF}" '%s' "${valid_hash}" > "${hash_file}" || {
error_msg "save hash - save_file_hash"
return 1
}
else
error_msg "invalid target - save_file_hash"
unset -v hash_file valid_hash valid_target
return 1
}
fi

# Save hash to target
"${EASYTLS_PRINTF}" '%s' "${valid_hash}" > "${hash_file}" || {
error_msg "save hash - save_file_hash"
return 1
}
update_master_hash=1
unset -v hash_file valid_hash valid_target
unset -v hash_file valid_hash
} # => save_file_hash ()

# Read hash from file (without cat) and clear EOF error
Expand Down

1 comment on commit 191679b

@TinCanTech
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.