add fd log

Signed-off-by: y30025806 <yangjunhui10@huawei.com>
Change-Id: Id48159d9d5a7fbd41acef781587ca1b91b525c75
This commit is contained in:
y30025806 2024-07-19 09:18:48 +08:00
parent 72cdce74b5
commit 32d4fb2c9a

View File

@ -111,8 +111,11 @@ int32_t AVSourceImpl::InitWithFD(int32_t fd, int64_t offset, int64_t size)
"Create source with fd failed because input offset is negative");
CHECK_AND_RETURN_RET_LOG(size > 0, AVCS_ERR_INVALID_VAL,
"Create source with fd failed because input size must be greater than zero");
if (fd <= 2) {
AVCODEC_LOGW("Using special fd: %{public}d, isatty: %{public}d", fd, isatty(fd));
}
int32_t flag = fcntl(fd, F_GETFL, 0);
CHECK_AND_RETURN_RET_LOG(flag >= 0, AVCS_ERR_INVALID_VAL, "get fd status failed");
CHECK_AND_RETURN_RET_LOG(flag >= 0, AVCS_ERR_INVALID_VAL, "Get fd status failed");
CHECK_AND_RETURN_RET_LOG(
(static_cast<uint32_t>(flag) & static_cast<uint32_t>(O_WRONLY)) != static_cast<uint32_t>(O_WRONLY),
AVCS_ERR_INVALID_VAL, "Fd not be permitted to read ");