xiaoxiang781216 commented on code in PR #10602: URL: https://github.com/apache/nuttx/pull/10602#discussion_r1361837030
########## libs/libc/stdio/lib_libfgets.c: ########## @@ -97,10 +97,11 @@ FAR char *lib_fgets_unlocked(FAR char *buf, size_t buflen, FILE *stream, bool keepnl, bool consume) { size_t nch = 0; + int fd = (int)(intptr_t)stream->fs_cookie; /* Sanity checks */ - if (!stream || !buf || stream->fs_fd < 0) + if (!stream || !buf || fd < 0) Review Comment: Yes, it's better to let the code which really use fd to do the check. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org