zabbix-agent2/src/zabbix_agent/logfiles/persistent_state.c
/******************************************************************************
 *                                                                            *
 * Function: create_persistent_directory                                      *
 *                                                                            *
 * Purpose: create directory if it does not exist or check access if it       *
 *          exists                                                            *
 *                                                                            *
 * Parameters:                                                                *
 *          pathname  - [IN] full pathname of directory                       *
 *          error     - [OUT] error message                                   *
 *                                                                            *
 * Return value: SUCCEED - directory created or already exists                *
 *               FAIL    - cannot create directory or it has insufficient     *
 *                         access rights (see dynamically allocated 'error')  *
 *                                                                            *
 ******************************************************************************/
create_persistent_directory

Purpose: create directory if it does not exist or check access if it
exists

Parameters:
pathname  - [IN] full pathname of directory
error     - [OUT] error message

Return value: SUCCEED - directory created or already exists
FAIL    - cannot create directory or it has insufficient
access rights
create_persistent_directory Purpose : create directory if it does not exist or check access if it exists Parameters : pathname - [ IN ] full pathname of directory error - [ OUT ] error message Return value : SUCCEED - directory created or already exists FAIL - cannot create directory or it has insufficient access rights
static int	create_persistent_directory(const char *pathname, char **error)
{
	if (0 != mkdir(pathname, S_IRWXU))
	{
		if (EEXIST == errno)
			return check_persistent_directory_exists(pathname, error);
		*error = zbx_dsprintf(*error, "%s(): cannot create directory \"%s\": %s", __func__, pathname,
				zbx_strerror(errno));
		return FAIL;
	}
	zabbix_log(LOG_LEVEL_DEBUG, "%s(): created directory:[%s]", __func__, pathname);
	return SUCCEED;
}
static int create_persistent_directory ( const char * pathname , char * * error ) { if ( 0 != mkdir ( pathname , S_IRWXU ) ) { if ( EEXIST == errno ) return check_persistent_directory_exists ( pathname , error ) ; * error = zbx_dsprintf ( * error , " \" \" " , __func__ , pathname , zbx_strerror ( errno ) ) ; return FAIL ; } zabbix_log ( LOG_LEVEL_DEBUG , " " , __func__ , pathname ) ; return SUCCEED ; }
Function: create_persistent_directory                                      
                                                                            
 Purpose: create directory if it does not exist or check access if it       
          exists                                                            
                                                                            
 Parameters:                                                                
          pathname  - [IN] full pathname of directory                       
          error     - [OUT] error message                                   
                                                                            
 Return value: SUCCEED - directory created or already exists                
               FAIL    - cannot create directory or it has insufficient     
                         access rights (see dynamically allocated 'error')
Function : create_persistent_directory Purpose : create directory if it does not exist or check access if it exists Parameters : pathname - [ IN ] full pathname of directory error - [ OUT ] error message Return value : SUCCEED - directory created or already exists FAIL - cannot create directory or it has insufficient access rights ( see dynamically allocated ' error ' )