diff options
Diffstat (limited to 'utils/mirror_vfd/mirror_server_stop.c')
-rw-r--r-- | utils/mirror_vfd/mirror_server_stop.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/utils/mirror_vfd/mirror_server_stop.c b/utils/mirror_vfd/mirror_server_stop.c index 024b33a..44386bf 100644 --- a/utils/mirror_vfd/mirror_server_stop.c +++ b/utils/mirror_vfd/mirror_server_stop.c @@ -60,7 +60,7 @@ struct mshs_opts { static void usage(void) { - HDprintf("mirror_server_halten_sie [options]\n" + HDprintf("mirror_server_stop [options]\n" "System-independent Mirror Server shutdown program.\n" "Sends shutdown message to Mirror Server at given IP:port\n" "\n" @@ -128,6 +128,7 @@ parse_args(int argc, char **argv, struct mshs_opts *opts) static int send_shutdown(struct mshs_opts *opts) { + char mybuf[16]; int live_socket; struct sockaddr_in target_addr; @@ -157,6 +158,16 @@ send_shutdown(struct mshs_opts *opts) return -1; } + /* Read & verify response from port connection. */ + if (HDread(live_socket, &mybuf, sizeof(mybuf)) == -1) { + HDprintf("ERROR read() can't receive data\n"); + return -1; + } + if (HDstrncmp("CLOSING", mybuf, 8)) { + HDprintf("ERROR read() didn't receive data from server\n"); + return -1; + } + if (HDclose(live_socket) < 0) { HDprintf("ERROR close() can't close socket\n"); return -1; |