Bug in users command
    Jef Poskanzer 
    jef at well.sf.ca.us
       
    Thu Jan 24 13:37:16 AEST 1991
    
    
  
In the referenced message, brnstnd at kramden.acf.nyu.edu (Dan Bernstein) wrote:
}(The most
}obvious implementation, of course, is to use char *'s, and add bytes
}manually.
Yeah, that's what I did when I wrote a users clone last year:
    #define MAXNAMES 1000
    static char users[MAXNAMES][UT_NAMESIZE+1];
    (void) strncpy( users[nusers], u.ut_name, UT_NAMESIZE );
    users[nusers][UT_NAMESIZE] = '\0';
And yes, this will fail if more than 1000 users are logged in at
the same time.  Imagine how concerned I am.
---
Jef
  Jef Poskanzer  jef at well.sf.ca.us  {apple, ucbvax, hplabs}!well!jef
      If ignorance is bliss, why aren't there more happy people?
    
    
More information about the Comp.std.c
mailing list