getlogin()
Returns the short user name of the currently logged in user. Unfortunately, it is often rather easy to fool getlogin(). Avoid getlogin() for security-related purposes.
e.g.
Etc.getlogin -> 'guest'
static VALUE etc_getlogin(VALUE obj) { char *login; rb_secure(4); #ifdef HAVE_GETLOGIN login = getlogin(); if (!login) login = getenv("USER"); #else login = getenv("USER"); #endif if (login) return rb_tainted_str_new2(login); return Qnil; }