[pve-devel] [PATCH ha-manager 2/5] small cleanup
Thomas Lamprecht
t.lamprecht at proxmox.com
Mon Jan 11 13:20:15 CET 2016
remove the unlink_socket variable and it's check as they wher
always true, as error and the end of the programm can only be
reached when the socket is already set up.
Also unlinking an non existent file does not result in any error.
also some whitespace cleanup in the surrounding area.
Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---
src/watchdog-mux.c | 14 +++++---------
1 file changed, 5 insertions(+), 9 deletions(-)
diff --git a/src/watchdog-mux.c b/src/watchdog-mux.c
index a74e90c..16eef64 100644
--- a/src/watchdog-mux.c
+++ b/src/watchdog-mux.c
@@ -106,8 +106,7 @@ main(void)
socklen_t peer_addr_size;
struct epoll_event ev, events[MAX_EVENTS];
int listen_sock, nfds, epollfd, sigfd;
- int unlink_socket = 0;
-
+
struct stat fs;
if (stat(WD_ACTIVE_MARKER, &fs) == 0) {
@@ -157,7 +156,6 @@ main(void)
/* always unlink socket path then create socket */
unlink(WD_SOCK_PATH);
- unlink_socket = 1;
listen_sock = socket(AF_UNIX, SOCK_STREAM, 0);
if (listen_sock == -1) {
@@ -350,15 +348,13 @@ main(void)
fprintf(stderr, "clean exit\n");
watchdog_close();
}
-
- if (unlink_socket)
- unlink(WD_SOCK_PATH);
-
+
+ unlink(WD_SOCK_PATH);
+
exit(EXIT_SUCCESS);
err:
- if (unlink_socket)
- unlink(WD_SOCK_PATH);
+ unlink(WD_SOCK_PATH);
exit(EXIT_FAILURE);
}
--
2.1.4
More information about the pve-devel
mailing list