You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/10/14 14:41:15 UTC

[GitHub] [incubator-nuttx] acassis commented on a diff in pull request #7310: libs/libc/stdio: fix ungetc operation

acassis commented on code in PR #7310:
URL: https://github.com/apache/incubator-nuttx/pull/7310#discussion_r995838280


##########
libs/libc/stdio/lib_ungetc.c:
##########
@@ -43,19 +43,17 @@ int ungetc(int c, FAR FILE *stream)
   int nungotten;
 #endif
 
-  /* Verify that a non-NULL stream was provided */
+  /* Verify that a non-NULL stream was provided and c is not EOF */
 
-  if (!stream)
+  if (!stream || c == EOF)

Review Comment:
   Initially I was thinking it couldn't never test 'c', but the only way it happen is if 'stream' is NULL, so the everything is fine!



-- 
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-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org