wangchdo commented on code in PR #17359:
URL: https://github.com/apache/nuttx/pull/17359#discussion_r2553715053


##########
fs/vfs/fs_signalfd.c:
##########
@@ -149,7 +149,7 @@ static int signalfd_file_close(FAR struct file *filep)
 
   for (signo = MIN_SIGNO; signo <= MAX_SIGNO; signo++)
     {
-      if (nxsig_ismember(&dev->sigmask, signo))
+      if (nxsig_ismember(&dev->sigmask, signo) == 1)

Review Comment:
   Could you please help explain why this approach is considered better?
   
   According to the definition of this API, the return value follows a clear 
convention:
   - 1 means the signal is a member of the set,
   - 0 means it is not a member,
   - -EINVAL indicates that the signo argument is invalid.
   
   Given this behavior, I think the return value should be handled explicitly 
as shown below:
   
   ```
   int ret = nxsig_ismember(&sigset, signo);
   
   if (ret == 1)
     {
       /* signo is a member */
     }
   else if (ret == 0)
     {
       /* signo is not a member */
     }
   else
     {
       /* ret == -EINVAL, signo is invalid */
     }
   
   ```
   



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to