system/adb: Fix error: 'fd' may be used uninitialized in this function

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2022-02-04 04:02:54 +08:00 committed by Petro Karashchenko
parent 09d778558c
commit 9534c640e8

View File

@ -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);