Handle the situation when connect_daemon returns -1

Fix #10117, close #10141
This commit is contained in:
topjohnwu
2026-10-06 03:45:05 +00:00
parent ba3f07268d
commit 441ac32623
2 changed files with 4 additions and 1 deletions
+3 -1
View File
@@ -97,7 +97,9 @@ int denylist_cli(rust::Vec<rust::String> &args) {
}
// Send request
int fd = connect_daemon(RequestCode::DENYLIST);
owned_fd fd = connect_daemon(RequestCode::DENYLIST);
if (fd < 0) exit(1);
write_int(fd, req);
if (req == DenyRequest::ADD || req == DenyRequest::REMOVE) {
write_string(fd, argv[1]);
+1
View File
@@ -210,6 +210,7 @@ end:
// Connect to client
owned_fd fd = connect_daemon(RequestCode::SUPERUSER);
if (fd < 0) exit(1);
// Send request
req.write_to_fd(fd);