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; break;
case MainResponse::ERROR: case MainResponse::ERROR:
LOGE("Daemon error\n"); LOGE("Daemon error\n");
close(fd);
return -1; return -1;
case MainResponse::ROOT_REQUIRED: case MainResponse::ROOT_REQUIRED:
LOGE("Root is required for this operation\n"); LOGE("Root is required for this operation\n");
close(fd);
return -1; return -1;
case MainResponse::ACCESS_DENIED: case MainResponse::ACCESS_DENIED:
LOGE("Access denied\n"); LOGE("Access denied\n");
close(fd);
return -1; return -1;
default: default:
__builtin_unreachable(); __builtin_unreachable();