diff options
Diffstat (limited to 'utils/mirror_vfd/mirror_server_stop.c')
-rw-r--r-- | utils/mirror_vfd/mirror_server_stop.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/utils/mirror_vfd/mirror_server_stop.c b/utils/mirror_vfd/mirror_server_stop.c index abc4c1e..44386bf 100644 --- a/utils/mirror_vfd/mirror_server_stop.c +++ b/utils/mirror_vfd/mirror_server_stop.c @@ -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; |