@@ -33,7 +33,7 @@ int main(int argc, char *argv[])
33
33
struct timeval begin_t , end_t ;
34
34
35
35
// swap 생성
36
- char swap_path [MAX_BUFFER_SIZE ];
36
+ char swap_path [BUFFER_SIZE ];
37
37
char command [MAX_BUFFER_SIZE ];
38
38
39
39
// 유효 검사
@@ -364,7 +364,7 @@ bool compare_file(file_node *src_file, file_node *dst_file) // 파일 정보 비
364
364
while (now != NULL ) {
365
365
366
366
#ifdef DEBUG
367
- printf ("compare_file(): src_file->name = %s, dst_file->name = %s\n" , src_file -> name + strlen (pwd ) + 1 , now -> name + strlen (pwd ) + 1 );
367
+ printf ("compare_file(): src_file->name = %s, dst_file->name = %s\n" , src_file -> name + strlen (pwd ) + 1 , now -> name + strlen (dst_path ) + 1 );
368
368
#endif
369
369
if (!strcmp (src_file -> name + strlen (pwd ) + 1 , now -> name + strlen (dst_path ) + 1 )) { // 파일 이름이 같은 경우
370
370
@@ -430,7 +430,7 @@ int write_change_list(file_node *head, int idx, int status, bool is_first) //
430
430
change_list [idx ].status = CREATE ;
431
431
} else if (status == DELETE ) { // 삭제됨
432
432
char tmp [MAX_BUFFER_SIZE ];
433
- sprintf (tmp , "%s/%s" , dst_path , get_file_name (src_path ));
433
+ sprintf (tmp , "%.* s/%s" , ( int ) strlen ( dst_path ) , dst_path , get_file_name (src_path ));
434
434
if (strstr (now -> name , tmp ) == NULL || !strcmp (now -> name , tmp ))
435
435
break ;
436
436
strcpy (change_list [idx ].name , now -> name );
@@ -494,7 +494,7 @@ void recovery(int signo) // SIGINT 시그널 처리
494
494
if (is_complete ) // 동기화가 완료되었을 경우
495
495
return ;
496
496
497
- sprintf (command , "tar -xvf %s" , swap_path ); // 복원 명령어 생성(압축 해제)
497
+ sprintf (command , "tar -xvf %.*s" , ( int ) strlen ( swap_path ) , swap_path ); // 복원 명령어 생성(압축 해제)
498
498
#ifdef DEBUG
499
499
printf ("recovery(): command = %s\n" , command );
500
500
#endif
0 commit comments