From 9e51e0fe03b4b27811f83670a615e6b9b64a7e88 Mon Sep 17 00:00:00 2001 From: Miles Bader Date: Fri, 20 Jun 1997 05:29:37 +0000 Subject: (main): Print the translated-node name instead of the translator name if the translator startup error is due to opening it. --- utils/settrans.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'utils') diff --git a/utils/settrans.c b/utils/settrans.c index 9230fb7a..9bd70303 100644 --- a/utils/settrans.c +++ b/utils/settrans.c @@ -161,6 +161,10 @@ main(int argc, char *argv[]) if (active && argz_len > 0) { + /* Error during file lookup; we use this to avoid duplicating error + messages. */ + error_t open_err = 0; + /* The callback to start_translator opens NODE as a side effect. */ error_t open_node (int flags, mach_port_t *underlying, @@ -174,7 +178,10 @@ main(int argc, char *argv[]) node = file_name_lookup (node_name, flags | lookup_flags, 0666); if (node == MACH_PORT_NULL) - return errno; + { + open_err = errno; + return open_err; + } *underlying = node; *underlying_type = MACH_MSG_TYPE_COPY_SEND; @@ -184,7 +191,9 @@ main(int argc, char *argv[]) err = fshelp_start_translator (open_node, argz, argz, argz_len, timeout, &active_control); if (err) - error(4, err, "%s", argz); + /* If ERR is due to a problem opening the translated node, we print + that name, otherwise, the name of the translator. */ + error(4, err, "%s", (err == open_err) ? node_name : argz); } else { -- cgit v1.2.3