]> jfr.im git - irc/ircd-hybrid/bopm.git/commitdiff
Check ret != -1 in total fd use count
authorstrtok <redacted>
Tue, 14 Jan 2003 02:43:36 +0000 (02:43 +0000)
committerstrtok <redacted>
Tue, 14 Jan 2003 02:43:36 +0000 (02:43 +0000)
src/stats.c

index 74ed6bfb421cdff4d5a15bb42ae1d1137f7c86e5..b972598562bdf16dd61754b51f79e4576e39a6c0 100644 (file)
@@ -204,7 +204,7 @@ void fdstats_output(char *target)
 {
    unsigned total_fd_use;
    struct rlimit rlim;
-   int i;
+   int i, ret;
 
    /* Get file descriptor ceiling */
    if(getrlimit(RLIMIT_NOFILE, &rlim) == -1)
@@ -219,8 +219,8 @@ void fdstats_output(char *target)
    total_fd_use = 0;
    for(i = 0; i < rlim.rlim_cur; i++)
    {
-      fcntl(i,F_GETFD,0);
-      if(errno != EBADF)
+      ret = fcntl(i,F_GETFD,0);
+      if((errno != EBADF) && (ret != -1))
          total_fd_use++;
    }