31 lines
1.4 KiB
Diff
31 lines
1.4 KiB
Diff
From e339956442fb7284bce31e132b0be7ad0f3badc5 Mon Sep 17 00:00:00 2001
|
|
From: Vit Mojzis <vmojzis@redhat.com>
|
|
Date: Tue, 2 Feb 2021 13:18:49 +0100
|
|
Subject: [PATCH] framework/sealert: exit on any connection close
|
|
|
|
SECommandLine is only connecting to setroubleshootd for a short time.
|
|
Therefore any connection close from "server" side should be treated as
|
|
error.
|
|
|
|
This prevents "sealert" from hanging when setroubleshootd crashes.
|
|
---
|
|
framework/src/sealert | 2 +-
|
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
|
diff --git a/framework/src/sealert b/framework/src/sealert
|
|
index 7839367..bae0c81 100755
|
|
--- a/framework/src/sealert
|
|
+++ b/framework/src/sealert
|
|
@@ -488,7 +488,7 @@ class SECommandLine(object):
|
|
def on_connection_state_change(self, connection, connection_state, flags, flags_added, flags_removed):
|
|
log_debug("%s.on_connection_state_change: connection_state=%s flags_added=%s flags_removed=%s address=%s" % (self.__class__.__name__, connection_state, connection_state.flags_to_string(flags_added), connection_state.flags_to_string(flags_removed), connection.socket_address))
|
|
|
|
- if flags_added & ConnectionState.ERROR:
|
|
+ if (flags_added & (ConnectionState.ERROR | ConnectionState.HUP)) or (flags_removed & ConnectionState.OPEN):
|
|
errno, strerror = connection_state.get_result()
|
|
print("failed to connect to server: %s" % (strerror), file=sys.stderr)
|
|
sys.exit(1)
|
|
--
|
|
2.29.2
|
|
|