4u2change/msdb.c
short msdb_communityPurge() 
{
    short          ret_val         = MSDB_FAILURE;
    DIR           *dir_p           = NULL;
    struct dirent *dirEntry_p      = NULL;
    char           tmpPath[ES_MAX_DIR_FILE_NAME_LEN];
    struct stat    file_info;

    /* Initialise storage structure. */
    memset(tmpPath,  0, sizeof(tmpPath));
    snprintf(tmpPath, sizeof(tmpPath), STORAGE_COMMUNITIES_DIRECTORY);

    dir_p = opendir(tmpPath);
    if (NULL != dir_p) {

        while (NULL != (dirEntry_p = readdir(dir_p))) {
            if ((strcmp(dirEntry_p->d_name,  ".") != 0) &&
                (strcmp(dirEntry_p->d_name, "..") != 0)) {

                memset(tmpPath, 0, sizeof(tmpPath));
                snprintf(tmpPath, sizeof(tmpPath), 
                         "%s/%s", STORAGE_COMMUNITIES_DIRECTORY, dirEntry_p->d_name);

                /* Regular file? */
                if ((!stat(tmpPath, &file_info)) &&
                    (S_ISREG(file_info.st_mode))) {

                    if (remove(tmpPath)) {
                        MSDB_ERROR("MSDB Community Purge, unable to delete community file <%s>!",
                            dirEntry_p->d_name);
                    }
                }
            }
        }
        closedir(dir_p);
        ret_val = MSDB_SUCCESS;
    }

    return ret_val;

}
/***************************************************************************/
/**
 * Delete all (purge) stored communities.
 *
 * @return MSDB_SUCCESS or MSDB_FAILURE
 ******************************************************************************/
Delete all (purge) stored communities.
Delete all ( purge ) stored communities .
short msdb_communityPurge() 
{
    short          ret_val         = MSDB_FAILURE;
    DIR           *dir_p           = NULL;
    struct dirent *dirEntry_p      = NULL;
    char           tmpPath[ES_MAX_DIR_FILE_NAME_LEN];
    struct stat    file_info;
    memset(tmpPath,  0, sizeof(tmpPath));
    snprintf(tmpPath, sizeof(tmpPath), STORAGE_COMMUNITIES_DIRECTORY);
    dir_p = opendir(tmpPath);
    if (NULL != dir_p) {
        while (NULL != (dirEntry_p = readdir(dir_p))) {
            if ((strcmp(dirEntry_p->d_name,  ".") != 0) &&
                (strcmp(dirEntry_p->d_name, "..") != 0)) {
                memset(tmpPath, 0, sizeof(tmpPath));
                snprintf(tmpPath, sizeof(tmpPath), 
                         "%s/%s", STORAGE_COMMUNITIES_DIRECTORY, dirEntry_p->d_name);
                if ((!stat(tmpPath, &file_info)) &&
                    (S_ISREG(file_info.st_mode))) {
                    if (remove(tmpPath)) {
                        MSDB_ERROR("MSDB Community Purge, unable to delete community file <%s>!",
                            dirEntry_p->d_name);
                    }
                }
            }
        }
        closedir(dir_p);
        ret_val = MSDB_SUCCESS;
    }
    return ret_val;
}
short msdb_communityPurge ( ) { short ret_val = MSDB_FAILURE ; DIR * dir_p = NULL ; struct dirent * dirEntry_p = NULL ; char tmpPath [ ES_MAX_DIR_FILE_NAME_LEN ] ; struct stat file_info ; memset ( tmpPath , 0 , sizeof ( tmpPath ) ) ; snprintf ( tmpPath , sizeof ( tmpPath ) , STORAGE_COMMUNITIES_DIRECTORY ) ; dir_p = opendir ( tmpPath ) ; if ( NULL != dir_p ) { while ( NULL != ( dirEntry_p = readdir ( dir_p ) ) ) { if ( ( strcmp ( dirEntry_p -> d_name , " " ) != 0 ) && ( strcmp ( dirEntry_p -> d_name , " " ) != 0 ) ) { memset ( tmpPath , 0 , sizeof ( tmpPath ) ) ; snprintf ( tmpPath , sizeof ( tmpPath ) , " " , STORAGE_COMMUNITIES_DIRECTORY , dirEntry_p -> d_name ) ; if ( ( ! stat ( tmpPath , & file_info ) ) && ( S_ISREG ( file_info . st_mode ) ) ) { if ( remove ( tmpPath ) ) { MSDB_ERROR ( " " , dirEntry_p -> d_name ) ; } } } } closedir ( dir_p ) ; ret_val = MSDB_SUCCESS ; } return ret_val ; }
Delete all (purge) stored communities.
Delete all ( purge ) stored communities .
/* Initialise storage structure. */ /* Regular file? */