@@ -621,7 +621,7 @@ void psync_update_cryptostatus(){
621
621
uint64_t u , crexp , crsub = 0 , is_business = 0 ;
622
622
int crst = 0 ,crstat ;
623
623
624
- binparam params [] = { P_STR ("auth" , psync_my_auth ) };
624
+ binparam params [] = { P_STR ("auth" , psync_my_auth ), P_STR ( "timeformat" , "timestamp" ) };
625
625
res = psync_api_run_command ("userinfo" , params );
626
626
if (!res ) {
627
627
debug (D_WARNING , "Send command returned invalid result.\n" );
@@ -691,34 +691,44 @@ static int check_write_permissions (psync_folderid_t folderid) {
691
691
psync_sql_free_result (res );
692
692
return ret ;
693
693
}
694
-
695
- psync_folderid_t psync_check_and_create_folder (const char * path ) {
696
- psync_folderid_t folderid = psync_get_folderid_by_path_or_create (path );
697
- if (folderid == PSYNC_INVALID_FOLDERID || (!check_write_permissions (folderid ))){
698
- char * buff = NULL ;
699
- uint32_t bufflen ;
700
- int ind = 1 ;
701
- char * err = NULL ;
694
+ static psync_folderid_t create_index_folder (const char * path ) {
695
+ char * buff = NULL ;
696
+ uint32_t bufflen ;
697
+ int ind = 1 ;
698
+ char * err ;
699
+ psync_folderid_t folderid ;
702
700
703
- while (ind < 100 ) {
704
- folderid = PSYNC_INVALID_FOLDERID ;
705
- bufflen = strlen (path ) + 1 /*zero char*/ + 3 /*parenthesis*/ + 3 /*up to 3 digit index*/ ;
706
- buff = (char * ) psync_malloc (bufflen );
707
- snprintf (buff , bufflen - 1 , "%s (%d)" , path , ind );
708
- if (psync_create_remote_folder_by_path (buff , & err )!= 0 )
709
- debug (D_NOTICE , "Unable to create folder %s error is %s." , buff , err );
710
- folderid = psync_get_folderid_by_path_or_create (buff );
711
- if ((folderid != PSYNC_INVALID_FOLDERID )&& check_write_permissions (folderid )) {
712
- psync_free (buff );
713
- break ;
714
- }
715
- ++ ind ;
716
-
717
- if (err )
718
- psync_free (err );
701
+ while (ind < 100 ) {
702
+ folderid = PSYNC_INVALID_FOLDERID ;
703
+ bufflen = strlen (path ) + 1 /*zero char*/ + 3 /*parenthesis*/ + 3 /*up to 3 digit index*/ ;
704
+ buff = (char * ) psync_malloc (bufflen );
705
+ snprintf (buff , bufflen - 1 , "%s (%d)" , path , ind );
706
+ if (psync_create_remote_folder_by_path (buff , & err )!= 0 )
707
+ debug (D_NOTICE , "Unable to create folder %s error is %s." , buff , err );
708
+ folderid = psync_get_folderid_by_path (buff );
709
+ if ((folderid != PSYNC_INVALID_FOLDERID )&& check_write_permissions (folderid )) {
719
710
psync_free (buff );
711
+ break ;
720
712
}
713
+ ++ ind ;
714
+ if (err )
715
+ psync_free (err );
716
+ psync_free (buff );
721
717
}
718
+ return folderid ;
719
+ }
720
+ psync_folderid_t psync_check_and_create_folder (const char * path ) {
721
+ psync_folderid_t folderid = psync_get_folderid_by_path (path );
722
+ char * err ;
723
+
724
+ if (folderid == PSYNC_INVALID_FOLDERID ) {
725
+ if (psync_create_remote_folder_by_path (path , & err )!= 0 ) {
726
+ debug (D_NOTICE , "Unable to create folder %s error is %s." , path , err );
727
+ psync_free (err );
728
+ folderid = create_index_folder (path );
729
+ }
730
+ } else if (!check_write_permissions (folderid ))
731
+ folderid = create_index_folder (path );
722
732
723
733
return folderid ;
724
734
}
0 commit comments