openbmc/build/tmp/deploy/sdk/witherspoon-2019-08-08/sysroots/armv6-openbmc-linux-gnueabi/usr/src/debug/libpam/1.3.1-r0/Linux-PAM-1.3.1/modules/pam_timestamp/pam_timestamp.c
static const char* check_tty(const char* tty)
{
    /* Check that we're not being set up to take a fall. */
    if ((tty == NULL) || (strlen(tty) == 0))
    {
        return NULL;
    }
    /* Pull out the meaningful part of the tty's name. */
    if (strchr(tty, '/') != NULL)
    {
        if (strncmp(tty, "/dev/", 5) != 0)
        {
            /* Make sure the device node is actually in /dev/,
             * noted by Michal Zalewski. */
            return NULL;
        }
        tty = strrchr(tty, '/') + 1;
    }
    /* Make sure the tty wasn't actually a directory (no basename). */
    if (!strlen(tty) || !strcmp(tty, ".") || !strcmp(tty, ".."))
    {
        return NULL;
    }
    return tty;
}
/* Validate a tty pathname as actually belonging to a tty, and return its base
 * name if it's valid. */
Validate a tty pathname as actually belonging to a tty, and return its base
name if it's valid.
Validate a tty pathname as actually belonging to a tty and return its base name if it ' s valid .
static const char* check_tty(const char* tty)
{
    if ((tty == NULL) || (strlen(tty) == 0))
    {
        return NULL;
    }
    if (strchr(tty, '/') != NULL)
    {
        if (strncmp(tty, "/dev/", 5) != 0)
        {
            return NULL;
        }
        tty = strrchr(tty, '/') + 1;
    }
    if (!strlen(tty) || !strcmp(tty, ".") || !strcmp(tty, ".."))
    {
        return NULL;
    }
    return tty;
}
static const char * check_tty ( const char * tty ) { if ( ( tty == NULL ) || ( strlen ( tty ) == 0 ) ) { return NULL ; } if ( strchr ( tty , ' ' ) != NULL ) { if ( strncmp ( tty , " " , 5 ) != 0 ) { return NULL ; } tty = strrchr ( tty , ' ' ) + 1 ; } if ( ! strlen ( tty ) || ! strcmp ( tty , " " ) || ! strcmp ( tty , " " ) ) { return NULL ; } return tty ; }
Validate a tty pathname as actually belonging to a tty, and return its base
 name if it's valid.
Validate a tty pathname as actually belonging to a tty and return its base name if it ' s valid .
/* Check that we're not being set up to take a fall. */ /* Pull out the meaningful part of the tty's name. */ /* Make sure the device node is actually in /dev/,
             * noted by Michal Zalewski. */ /* Make sure the tty wasn't actually a directory (no basename). */