summaryrefslogtreecommitdiff
path: root/utils/settrans.c
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>1995-11-06 21:17:40 +0000
committerMiles Bader <miles@gnu.org>1995-11-06 21:17:40 +0000
commit7449f71e5d38361546520ac90a8d55ddb483172e (patch)
tree5a506f724d4302a4ad79a3815ad338f95dfe89fa /utils/settrans.c
parent28ca9199b27a1aee8f34ecc790f8e71429d53d72 (diff)
(main):
Change to use the new wierd callback interface to fshelp_start_translator.
Diffstat (limited to 'utils/settrans.c')
-rw-r--r--utils/settrans.c27
1 files changed, 21 insertions, 6 deletions
diff --git a/utils/settrans.c b/utils/settrans.c
index c0c21d15..a235a426 100644
--- a/utils/settrans.c
+++ b/utils/settrans.c
@@ -116,18 +116,33 @@ main(int argc, char *argv[])
if (!active && !passive)
passive = 1;
- node = file_name_lookup(node_name, lookup_flags, 0666);
- if (node == MACH_PORT_NULL)
- error(1, errno, "%s", node_name);
-
if (active && argz_len > 0)
{
- err = fshelp_start_translator (node, MACH_MSG_TYPE_COPY_SEND,
- argz, argz, argz_len, 60000,
+ /* The callback to start_translator opens NODE as a side effect. */
+ error_t open_node (int flags,
+ mach_port_t *underlying,
+ mach_msg_type_name_t *underlying_type)
+ {
+ node = file_name_lookup (node_name, flags | lookup_flags, 0666);
+ if (node == MACH_PORT_NULL)
+ return errno;
+
+ *underlying = node;
+ *underlying_type = MACH_MSG_TYPE_COPY_SEND;
+
+ return 0;
+ }
+ err = fshelp_start_translator (open_node, argz, argz, argz_len, 60000,
&active_control);
if (err)
error(4, err, "%s", argz);
}
+ else
+ {
+ node = file_name_lookup(node_name, lookup_flags, 0666);
+ if (node == MACH_PORT_NULL)
+ error(1, errno, "%s", node_name);
+ }
err =
file_set_translator(node,