Changes in storage_xml.c [5f5d433:88d2208]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
storage_xml.c
r5f5d433 r88d2208 30 30 #include "md5.h" 31 31 #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 32 40 33 41 typedef enum … … 244 252 static void xml_init( void ) 245 253 { 246 if( ! g_file_test( global.conf->configdir, G_FILE_TEST_EXISTS ))254 if( g_access( global.conf->configdir, F_OK ) != 0 ) 247 255 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 ) 249 258 log_message( LOGLVL_WARNING, "Permission problem: Can't read/write from/to `%s'.", global.conf->configdir ); 250 259 } … … 373 382 g_free( path2 ); 374 383 375 if( !overwrite && g_ file_test( path, G_FILE_TEST_EXISTS ))384 if( !overwrite && g_access( path, F_OK ) == 0 ) 376 385 return STORAGE_ALREADY_EXISTS; 377 386 … … 481 490 static storage_status_t xml_remove( const char *nick, const char *password ) 482 491 { 483 char s[512] ;492 char s[512], *lc; 484 493 storage_status_t status; 485 494 … … 488 497 return status; 489 498 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 491 504 if( unlink( s ) == -1 ) 492 505 return STORAGE_OTHER_ERROR;
Note: See TracChangeset
for help on using the changeset viewer.