diff options
author | John Kohl <jtkohl@mit.edu> | 1989-11-29 06:16:07 +0000 |
---|---|---|
committer | John Kohl <jtkohl@mit.edu> | 1989-11-29 06:16:07 +0000 |
commit | b404634271383f8a8245616e043feefb1b840525 (patch) | |
tree | 10fe558bba9a6958f8c47318033193743b724d60 /zwgc/zephyr.c | |
parent | 6b3a8c3bf7b0c091e5d9f3a1159cf7fbf1b5e5a0 (diff) |
add code to only finalize if init was called.
[may be necessary due to XIOErrorHandler
Diffstat (limited to 'zwgc/zephyr.c')
-rw-r--r-- | zwgc/zephyr.c | 41 |
1 files changed, 24 insertions, 17 deletions
diff --git a/zwgc/zephyr.c b/zwgc/zephyr.c index 1f0a6ce..a3ac66d 100644 --- a/zwgc/zephyr.c +++ b/zwgc/zephyr.c @@ -119,6 +119,8 @@ static void handle_zephyr_input(notice_handler) } } } + +static int zephyr_inited = 0; /* * @@ -189,6 +191,8 @@ void zephyr_init(notice_handler) */ mux_add_input_source(ZGetFD(), (void (*)())handle_zephyr_input, (pointer)notice_handler); + zephyr_inited = 1; + return; } /* @@ -199,22 +203,25 @@ void finalize_zephyr() /* <<<>>> */ { string temp; - /* - * Remove the file containing our port # since it is no longer needed: - */ - errno = 0; - temp = get_zwgc_port_number_filename(); - unlink(temp); - if (errno) { - fprintf(stderr, "zwgc: error while trying to delete %s: ", temp); - perror(""); - } + if (zephyr_inited) { + /* + * Remove the file containing our port # since it is no longer needed: + */ + errno = 0; + temp = get_zwgc_port_number_filename(); + unlink(temp); + if (errno) { + fprintf(stderr, "zwgc: error while trying to delete %s: ", temp); + perror(""); + } - /* - * Cancel our subscriptions, unset our location, and close our zephyr - * connection: - */ - TRAP( ZCancelSubscriptions(0), "while canceling subscriptions" ); - TRAP( ZUnsetLocation(), "while unsetting location" ); - ZClosePort(); + /* + * Cancel our subscriptions, unset our location, and close our zephyr + * connection: + */ + TRAP( ZCancelSubscriptions(0), "while canceling subscriptions" ); + TRAP( ZUnsetLocation(), "while unsetting location" ); + ZClosePort(); + } + return; } |