From 9534c640e8ac480a6027f3a4c83b52f2964ea956 Mon Sep 17 00:00:00 2001 From: Xiang Xiao Date: Fri, 4 Feb 2022 04:02:54 +0800 Subject: [PATCH] system/adb: Fix error: 'fd' may be used uninitialized in this function Signed-off-by: Xiang Xiao --- system/adb/logcat_service.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/system/adb/logcat_service.c b/system/adb/logcat_service.c index c35944f01..ba6bc7faa 100644 --- a/system/adb/logcat_service.c +++ b/system/adb/logcat_service.c @@ -1,5 +1,5 @@ /**************************************************************************** - * apps/system/adb/logcat_service_uv.c + * apps/system/adb/logcat_service.c * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -133,9 +133,10 @@ static void logcat_on_data_available(uv_poll_t * handle, goto exit_stop_service; } - assert(uv_fileno((uv_handle_t *)handle, &fd) == 0); - ret = read(fd, ap->p.data, CONFIG_ADBD_PAYLOAD_SIZE); + ret = uv_fileno((uv_handle_t *)handle, &fd); + assert(ret == 0); + ret = read(fd, ap->p.data, CONFIG_ADBD_PAYLOAD_SIZE); if (ret < 0) { adb_log("frame read failed %d %d\n", ret, errno);