openbmc/build/tmp/deploy/sdk/witherspoon-2019-08-08/sysroots/armv6-openbmc-linux-gnueabi/usr/src/debug/util-linux/2.33.2-r0/util-linux-2.33.2/login-utils/su-common.c
static void log_btmp(struct su_context* su)
{
    struct utmpx ut;
    struct timeval tv;

    DBG(LOG, ul_debug("btmp logging"));

    memset(&ut, 0, sizeof(ut));
    str2memcpy(ut.ut_user,
               su->pwd && su->pwd->pw_name ? su->pwd->pw_name : "(unknown)",
               sizeof(ut.ut_user));

    if (su->tty_number)
        str2memcpy(ut.ut_id, su->tty_number, sizeof(ut.ut_id));
    if (su->tty_name)
        str2memcpy(ut.ut_line, su->tty_name, sizeof(ut.ut_line));

    gettimeofday(&tv, NULL);
    ut.ut_tv.tv_sec = tv.tv_sec;
    ut.ut_tv.tv_usec = tv.tv_usec;
    ut.ut_type = LOGIN_PROCESS; /* XXX doesn't matter */
    ut.ut_pid = getpid();

    updwtmpx(_PATH_BTMP, &ut);
}
/*
 * Log failed login attempts in _PATH_BTMP if that exists.
 */
Log failed login attempts in _PATH_BTMP if that exists.
Log failed login attempts in _PATH_BTMP if that exists .
static void log_btmp(struct su_context* su)
{
    struct utmpx ut;
    struct timeval tv;
    DBG(LOG, ul_debug("btmp logging"));
    memset(&ut, 0, sizeof(ut));
    str2memcpy(ut.ut_user,
               su->pwd && su->pwd->pw_name ? su->pwd->pw_name : "(unknown)",
               sizeof(ut.ut_user));
    if (su->tty_number)
        str2memcpy(ut.ut_id, su->tty_number, sizeof(ut.ut_id));
    if (su->tty_name)
        str2memcpy(ut.ut_line, su->tty_name, sizeof(ut.ut_line));
    gettimeofday(&tv, NULL);
    ut.ut_tv.tv_sec = tv.tv_sec;
    ut.ut_tv.tv_usec = tv.tv_usec;
    ut.ut_type = LOGIN_PROCESS; 
    ut.ut_pid = getpid();
    updwtmpx(_PATH_BTMP, &ut);
}
static void log_btmp ( struct su_context * su ) { struct utmpx ut ; struct timeval tv ; DBG ( LOG , ul_debug ( " " ) ) ; memset ( & ut , 0 , sizeof ( ut ) ) ; str2memcpy ( ut . ut_user , su -> pwd && su -> pwd -> pw_name ? su -> pwd -> pw_name : " " , sizeof ( ut . ut_user ) ) ; if ( su -> tty_number ) str2memcpy ( ut . ut_id , su -> tty_number , sizeof ( ut . ut_id ) ) ; if ( su -> tty_name ) str2memcpy ( ut . ut_line , su -> tty_name , sizeof ( ut . ut_line ) ) ; gettimeofday ( & tv , NULL ) ; ut . ut_tv . tv_sec = tv . tv_sec ; ut . ut_tv . tv_usec = tv . tv_usec ; ut . ut_type = LOGIN_PROCESS ; ut . ut_pid = getpid ( ) ; updwtmpx ( _PATH_BTMP , & ut ) ; }
Log failed login attempts in _PATH_BTMP if that exists.
Log failed login attempts in _PATH_BTMP if that exists .
/* XXX doesn't matter */