fjpanag commented on PR #9497:
URL: https://github.com/apache/nuttx/pull/9497#issuecomment-1599562628

   @hujun260 Here is what I think it happens:
   
   1. `select()` is called, and uses `fdcheck_restore()`.
   2. `select()` is calling `poll()` internally.
   3. `poll()` calls `poll_setup()`.
   4. `poll_setup()` calls `poll_fdsetup()`.
   5. `poll_fdsetup()` calls `fs_getfilep()` before `file_poll()`.
   6. `fs_getfilep()` calls *again* `fdcheck_restore()` on an already restored 
file descriptor.
   
   I added prints, and I verified that the error originates 
[here](https://github.com/apache/nuttx/blob/master/fs/inode/fs_files.c#L469) 
(following the above sequence).
   
   The actual error is `EBADF` (no idea why `errno` contained garbage).


-- 
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

Reply via email to