It possible that we try to use victim_sock even when we couldn't open
it. This is never actually harmful but it looks wrong and it is best
to fix it.
Signed-off-by: NeilBrown <neilb@suse.de>
kill(pid, SIGTERM);
+ if (sock < 0)
+ return;
+
/* Wait for monitor to exit by reading from the socket, after
* clearing the non-blocking flag */
fl = fcntl(sock, F_GETFL, 0);
exit(3);
}
close(victim_sock);
+ victim_sock = -1;
}
if (container->ss->load_container(container, mdfd, devname)) {
fprintf(stderr, "mdmon: Cannot load metadata for %s\n",
if (victim > 0) {
try_kill_monitor(victim, container->devname, victim_sock);
- close(victim_sock);
+ if (victim_sock >= 0)
+ close(victim_sock);
}
setsid();