diff options
author | Bryan Drewery <bryan@shatow.net> | 2022-11-10 02:06:07 +0300 |
---|---|---|
committer | Bryan Drewery <bryan@shatow.net> | 2022-11-10 02:06:20 +0300 |
commit | 2b13f915e1f8aeb5bba52bd52d33879f4fd481bc (patch) | |
tree | 4f83015619753d9249ac4f5d4c234d84af65fb4a | |
parent | bac8a649e2717554700b7e04f8b226db41d883dc (diff) |
mapfile sh: Clarify some errors
-rw-r--r-- | src/share/poudriere/include/util.sh | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/share/poudriere/include/util.sh b/src/share/poudriere/include/util.sh index 8debed3c..97c62ee5 100644 --- a/src/share/poudriere/include/util.sh +++ b/src/share/poudriere/include/util.sh @@ -751,8 +751,8 @@ mapfile_read() { local handle="$1" shift - if [ "${handle}" != "${_mapfile_handle}" ]; then - err 1 "mapfile_read: Handle '${handle}' is not open, '${_mapfile_handle}' is" + if [ "${handle}" != "${_mapfile_handle-}" ]; then + err 1 "mapfile_read: Handle '${handle}' is not open${_mapfile_handle:+, '${_mapfile_handle}' is}." fi hash_get mapfile_fd "${handle}" fd || fd=8 @@ -781,8 +781,8 @@ mapfile_write() { handle="$1" shift - if [ "${handle}" != "${_mapfile_handle}" ]; then - err 1 "mapfile_write: Handle '${handle}' is not open, '${_mapfile_handle}' is" + if [ "${handle}" != "${_mapfile_handle-}" ]; then + err 1 "mapfile_write: Handle '${handle}' is not open${_mapfile_handle:+, '${_mapfile_handle}' is}." fi hash_get mapfile_fd "${handle}" fd || fd=8 echo ${nflag:+-n} "$@" >&${fd} @@ -795,7 +795,7 @@ mapfile_close() { local fd _ if [ "${handle}" != "${_mapfile_handle}" ]; then - err 1 "mapfile_close: Handle '${handle}' is not open, '${_mapfile_handle}' is" + err 1 "mapfile_close: Handle '${handle}' is not open${_mapfile_handle:+, '${_mapfile_handle}' is}." fi # Only close fd that we opened. if ! hash_remove mapfile_fd "${handle}" _; then |