Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • storage_xml.c

    r5f5d433 r88d2208  
    3030#include "md5.h"
    3131#include <glib/gstdio.h>
     32
     33#if GLIB_CHECK_VERSION(2,8,0)
     34#include <glib/gstdio.h>
     35#else
     36/* GLib < 2.8.0 doesn't have g_access, so just use the system access(). */
     37#include <unistd.h>
     38#define g_access access
     39#endif
    3240
    3341typedef enum
     
    244252static void xml_init( void )
    245253{
    246         if( ! g_file_test( global.conf->configdir, G_FILE_TEST_EXISTS ) )
     254        if( g_access( global.conf->configdir, F_OK ) != 0 )
    247255                log_message( LOGLVL_WARNING, "The configuration directory `%s' does not exist. Configuration won't be saved.", global.conf->configdir );
    248         else if( ! g_file_test( global.conf->configdir, G_FILE_TEST_EXISTS ) || g_access( global.conf->configdir, W_OK ) != 0 )
     256        else if( g_access( global.conf->configdir, F_OK ) != 0 ||
     257                 g_access( global.conf->configdir, W_OK ) != 0 )
    249258                log_message( LOGLVL_WARNING, "Permission problem: Can't read/write from/to `%s'.", global.conf->configdir );
    250259}
     
    373382        g_free( path2 );
    374383       
    375         if( !overwrite && g_file_test( path, G_FILE_TEST_EXISTS ) )
     384        if( !overwrite && g_access( path, F_OK ) == 0 )
    376385                return STORAGE_ALREADY_EXISTS;
    377386       
     
    481490static storage_status_t xml_remove( const char *nick, const char *password )
    482491{
    483         char s[512];
     492        char s[512], *lc;
    484493        storage_status_t status;
    485494
     
    488497                return status;
    489498
    490         g_snprintf( s, 511, "%s%s%s", global.conf->configdir, nick, ".xml" );
     499        lc = g_strdup( nick );
     500        nick_lc( lc );
     501        g_snprintf( s, 511, "%s%s%s", global.conf->configdir, lc, ".xml" );
     502        g_free( lc );
     503       
    491504        if( unlink( s ) == -1 )
    492505                return STORAGE_OTHER_ERROR;
Note: See TracChangeset for help on using the changeset viewer.