Close fd of erroneous daemon socket connections

This commit is contained in:
canyie 2022-09-11 23:33:06 +08:00 committed by John Wu
parent e86db0bd61
commit 9474750bdf

View File

@ -447,12 +447,15 @@ int connect_daemon(int req, bool create) {
break;
case MainResponse::ERROR:
LOGE("Daemon error\n");
close(fd);
return -1;
case MainResponse::ROOT_REQUIRED:
LOGE("Root is required for this operation\n");
close(fd);
return -1;
case MainResponse::ACCESS_DENIED:
LOGE("Access denied\n");
close(fd);
return -1;
default:
__builtin_unreachable();