Connection:: ~Connection() { if (inbuf) delete inbuf; if (outbuf) delete outbuf; /* This has to be called BEFORE freeing misc_info */ if (*ops_free) ops_free(this); if (misc_info) { free(misc_info); misc_info = NULL; } #if HAVE_OPENSSL if (ssl_session) SSL_SESSION_free((SSL_SESSION*)ssl_session); ssl_session = NULL; #endif }
static void perform_merge(int op) { #ifndef _WIN32 struct stat src, dst; #endif ops_t *ops; create_empty_dir("first"); create_empty_dir("first/nested1"); create_empty_dir("first/nested1/nested2"); create_empty_file("first/nested1/nested2/file"); create_empty_dir("second"); create_empty_dir("second/nested1"); #ifndef _WIN32 /* Something about GNU Hurd and OS X differs, so skip this workaround there. * Really need to figure out what's wrong with this thing... */ #if !defined(__gnu_hurd__) && !defined(__APPLE__) { struct timeval tv[2]; gettimeofday(&tv[0], NULL); tv[1] = tv[0]; /* This might be Linux-specific, but for the test to work properly access * time should be newer than modification time, in which case it's not * changed on listing directory. */ tv[0].tv_sec += 3; tv[0].tv_usec += 4; tv[1].tv_sec += 1; tv[1].tv_usec += 2; utimes("first/nested1", tv); } #endif assert_success(chmod("first/nested1", 0700)); assert_success(os_stat("first/nested1", &src)); #endif cmd_group_begin("undo msg"); assert_non_null(ops = ops_alloc(op, 0, "merge", ".", ".")); ops->crp = CRP_OVERWRITE_ALL; if(op == OP_MOVEF) { assert_success(merge_dirs("first", "second", ops)); } else { #ifndef _WIN32 if(!cfg.use_system_calls) { assert_success( perform_operation(op, ops, NULL, "first/nested1", "second/")); } else #endif { assert_success(perform_operation(op, ops, NULL, "first", "second")); } } ops_free(ops); cmd_group_end(); #ifndef _WIN32 { assert_success(os_stat("second/nested1", &dst)); #ifndef HAVE_STRUCT_STAT_ST_MTIM #define st_atim st_atime #define st_mtim st_mtime #endif assert_success(memcmp(&src.st_atim, &dst.st_atim, sizeof(src.st_atim))); assert_success(memcmp(&src.st_mtim, &dst.st_mtim, sizeof(src.st_mtim))); assert_success(memcmp(&src.st_mode, &dst.st_mode, sizeof(src.st_mode))); } #endif assert_true(file_exists("second/nested1/nested2/file")); assert_success(unlink("second/nested1/nested2/file")); assert_success(rmdir("second/nested1/nested2")); assert_success(rmdir("second/nested1")); assert_success(rmdir("second")); }