I have a question about codes in file snmp_api.c  

int
snmp_sess_select_info(void *sessp,
                      int *numfds,
                      fd_set * fdset, struct timeval *timeout, int *block)
{
  int rc;
  netsnmp_large_fd_set lfdset;
  netsnmp_large_fd_set_init(&lfdset, FD_SETSIZE);
  netsnmp_copy_fd_set_to_large_fd_set(&lfdset, fdset);
  rc = snmp_sess_select_info2(sessp, numfds, &lfdset, timeout, block);
  if (netsnmp_copy_large_fd_set_to_fd_set(fdset, &lfdset) < 0) {
      snmp_log(LOG_ERR,
     "Use snmp_sess_select_info2() for processing"
     " large file descriptors");
  }
  netsnmp_large_fd_set_cleanup(&lfdset);
  return rc;
}

after call snmp_sess_select_info2 , all infomation is in lfdset, Next they call 
netsnmp_copy_large_fd_set_to_fd_set?

in function :
int
netsnmp_copy_large_fd_set_to_fd_set(fd_set * dst,
                                    const netsnmp_large_fd_set * src)
{
    
    /* Report failure if *src is larger than FD_SETSIZE. */
    if (src->lfs_setsize > FD_SETSIZE) {
        FD_ZERO(dst);
        return -1;
    }
    
    ... ...

because src->lfs_setsize has been resized in the previous (see function 
snmp_sess_select_info2, 

call NETSNMP_LARGE_FD_SET(slp->transport->sock, fdset); ), it must be greater 
than FD_SETSIZE,

function netsnmp_copy_large_fd_set_to_fd_set always returns -1 in large file 
descriptor. 

Is there a bug?

Thanks!!

2010-06-22 



s00110979 
------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to