4u2change/msdb.c
short msdb_communityExists(
    const uint8_t *community)
{
    short       ret_val = MSDB_FALSE;
    char        filename[ES_MAX_DIR_FILE_NAME_LEN];
    struct stat file_info;

    if (NULL != community) {
        memset(filename, 0, sizeof(filename));
        snprintf(filename, sizeof(filename), "%s/%s", 
                 STORAGE_COMMUNITIES_DIRECTORY, community);

        if ((!stat(filename, &file_info)) && /* Regular file? */
            (S_ISREG(file_info.st_mode))) {
                ret_val = MSDB_TRUE;
        }
    }

    return ret_val;

}
/***************************************************************************/
/**
 * Check whether the specified community exists.
 *
 * @param[in]  community The community name to check if it exists.
 *
 * @return ES_TRUE or ES_FALSE
 ******************************************************************************/
Check whether the specified community exists.
@param[in]  community The community name to check if it exists.


Check whether the specified community exists . @param [ in ] community The community name to check if it exists .
short msdb_communityExists(
    const uint8_t *community)
{
    short       ret_val = MSDB_FALSE;
    char        filename[ES_MAX_DIR_FILE_NAME_LEN];
    struct stat file_info;
    if (NULL != community) {
        memset(filename, 0, sizeof(filename));
        snprintf(filename, sizeof(filename), "%s/%s", 
                 STORAGE_COMMUNITIES_DIRECTORY, community);
        if ((!stat(filename, &file_info)) && 
            (S_ISREG(file_info.st_mode))) {
                ret_val = MSDB_TRUE;
        }
    }
    return ret_val;
}
short msdb_communityExists ( const uint8_t * community ) { short ret_val = MSDB_FALSE ; char filename [ ES_MAX_DIR_FILE_NAME_LEN ] ; struct stat file_info ; if ( NULL != community ) { memset ( filename , 0 , sizeof ( filename ) ) ; snprintf ( filename , sizeof ( filename ) , " " , STORAGE_COMMUNITIES_DIRECTORY , community ) ; if ( ( ! stat ( filename , & file_info ) ) && ( S_ISREG ( file_info . st_mode ) ) ) { ret_val = MSDB_TRUE ; } } return ret_val ; }
Check whether the specified community exists.
Check whether the specified community exists .
/* Regular file? */