Gave up risky direct update of hardlink siblings
This commit is contained in:
@ -5398,6 +5398,9 @@ int Xorriso_new(struct XorrisO ** xorriso,char *progname, int flag)
|
||||
m->hln_count= 0;
|
||||
m->hln_array= NULL;
|
||||
m->hln_targets= NULL;
|
||||
m->di_do_widen= NULL;
|
||||
m->di_disk_paths= NULL;
|
||||
m->di_iso_paths= NULL;
|
||||
|
||||
m->node_targets_availmem= 0;
|
||||
|
||||
@ -8351,6 +8354,28 @@ ex:;
|
||||
}
|
||||
|
||||
|
||||
int Xorriso_pfx_disk_path(struct XorrisO *xorriso, char *iso_path,
|
||||
char *iso_prefix, char *disk_prefix,
|
||||
char disk_path[SfileadrL], int flag)
|
||||
{
|
||||
int ret;
|
||||
char adrc[SfileadrL];
|
||||
|
||||
if(strncmp(iso_path, iso_prefix, strlen(iso_prefix))!=0)
|
||||
return(-1);
|
||||
if(strlen(disk_prefix) + strlen(iso_path) - strlen(iso_prefix)+1 >= SfileadrL)
|
||||
return(-1);
|
||||
if(iso_path[strlen(iso_prefix)] == '/')
|
||||
strcpy(adrc, iso_path + strlen(iso_prefix) + 1);
|
||||
else
|
||||
strcpy(adrc, iso_path + strlen(iso_prefix));
|
||||
ret= Xorriso_make_abs_adr(xorriso, disk_prefix, adrc, disk_path, 4 | 8);
|
||||
if(ret <= 0)
|
||||
return(ret);
|
||||
return(1);
|
||||
}
|
||||
|
||||
|
||||
/* @param boss_iter Opaque handle to be forwarded to actions in ISO image
|
||||
Set to NULL if calling this function from outside ISO world
|
||||
@param flag bit0= update rather than compare
|
||||
@ -8363,19 +8388,11 @@ int Xorriso_find_compare(struct XorrisO *xorriso, void *boss_iter,
|
||||
int flag)
|
||||
{
|
||||
int ret, result, uret, follow_links, deleted= 0;
|
||||
char disk_path[SfileadrL], adrc[SfileadrL];
|
||||
char disk_path[SfileadrL];
|
||||
|
||||
if(strncmp(iso_path, iso_prefix, strlen(iso_prefix))!=0)
|
||||
return(-1);
|
||||
if(strlen(disk_prefix)+strlen(iso_path)-strlen(iso_prefix)+1>=SfileadrL)
|
||||
return(-1);
|
||||
if(iso_path[strlen(iso_prefix)]=='/')
|
||||
strcpy(adrc, iso_path+strlen(iso_prefix)+1);
|
||||
else
|
||||
strcpy(adrc, iso_path+strlen(iso_prefix));
|
||||
|
||||
ret= Xorriso_make_abs_adr(xorriso, disk_prefix, adrc, disk_path, 4|8);
|
||||
if(ret<=0)
|
||||
ret= Xorriso_pfx_disk_path(xorriso, iso_path, iso_prefix, disk_prefix,
|
||||
disk_path, 0);
|
||||
if(ret <= 0)
|
||||
return(ret);
|
||||
|
||||
/* compare exclusions against disk_path resp. leaf name */
|
||||
@ -8390,7 +8407,7 @@ int Xorriso_find_compare(struct XorrisO *xorriso, void *boss_iter,
|
||||
|
||||
follow_links= (xorriso->do_follow_links ||
|
||||
(xorriso->do_follow_param && !(flag&2))) <<28;
|
||||
ret= Xorriso_compare_2_files(xorriso, disk_path, iso_path, adrc, &result,
|
||||
ret= Xorriso_compare_2_files(xorriso, disk_path, iso_path, "", &result,
|
||||
2 | follow_links | ((!(flag&2))<<27) | ((flag&1)<<31));
|
||||
/* was once: | ((!(flag&1))<<29) */
|
||||
if(ret<xorriso->find_compare_result)
|
||||
@ -15359,13 +15376,16 @@ not_enough_exec_arguments:;
|
||||
Findjob_set_action_subjob(job, 13, new_job, 0);
|
||||
job= new_job;
|
||||
|
||||
} else if(strcmp(cpt, "compare")==0 || strcmp(cpt, "update")==0) {
|
||||
} else if(strcmp(cpt, "compare")==0 || strcmp(cpt, "update")==0 ||
|
||||
strcmp(cpt, "widen_hardlinks")==0) {
|
||||
if(i+1>=end_idx)
|
||||
goto not_enough_exec_arguments;
|
||||
i++;
|
||||
action= 14;
|
||||
if(strcmp(cpt, "update")==0)
|
||||
action= 17;
|
||||
if(strcmp(cpt, "widen_hardlinks")==0)
|
||||
action= 32;
|
||||
ret= Xorriso_make_abs_adr(xorriso, xorriso->wdx, argv[i],
|
||||
other_path_start, 1|2|4|8);
|
||||
if(ret<=0)
|
||||
@ -15689,14 +15709,14 @@ int Xorriso_option_hardlinks(struct XorrisO *xorriso, char *mode, int flag)
|
||||
} else if(strcmp(mode, "without_update") == 0) {
|
||||
xorriso->ino_behavior&= ~(1 | 2 | 4);
|
||||
xorriso->ino_behavior|= 8;
|
||||
Xorriso_destroy_di_array(xorriso, 0);
|
||||
Xorriso_finish_hl_update(xorriso, 0);
|
||||
} else if(strcmp(mode, "start_update") == 0) {
|
||||
xorriso->ino_behavior&= ~(1 | 2 | 4 | 8);
|
||||
ret= Xorriso_make_di_array(xorriso, 1);
|
||||
if(ret <= 0)
|
||||
return(ret);
|
||||
} else if(strcmp(mode, "end_update") == 0) {
|
||||
Xorriso_destroy_di_array(xorriso, 0);
|
||||
Xorriso_finish_hl_update(xorriso, 0);
|
||||
} else if(strcmp(mode, "start_extract") == 0) {
|
||||
xorriso->do_restore_sort_lba= 0;
|
||||
xorriso->ino_behavior&= ~(1 | 2 | 4);
|
||||
@ -16810,7 +16830,7 @@ ex:;
|
||||
Sfile_destroy_argv(&i, &eff_tgt_array, 0);
|
||||
(*idx)= end_idx;
|
||||
if(made_di_array)
|
||||
Xorriso_destroy_di_array(xorriso, 0);
|
||||
Xorriso_finish_hl_update(xorriso, 0);
|
||||
if(made_hln_array)
|
||||
Xorriso_destroy_hln_array(xorriso, 0);
|
||||
Xorriso_opt_args(xorriso, cmd, argc, argv, *idx, &end_idx, &optc, &optv, 256);
|
||||
@ -18558,7 +18578,7 @@ int Xorriso_option_uid(struct XorrisO *xorriso, char *uid, int flag)
|
||||
int Xorriso_option_update(struct XorrisO *xorriso, char *disk_path,
|
||||
char *iso_path, int flag)
|
||||
{
|
||||
int ret, mem_pci, zero= 0, result, uret, follow_links;
|
||||
int ret, mem_pci, zero= 0, result, uret, follow_links, do_register= 1;
|
||||
int not_in_iso= 0, not_on_disk= 0, made_di_array= 0;
|
||||
double mem_lut= 0.0, start_time;
|
||||
char *ipth, *argv[6], sfe[5*SfileadrL];
|
||||
@ -18605,13 +18625,33 @@ int Xorriso_option_update(struct XorrisO *xorriso, char *disk_path,
|
||||
if(ret!=0)
|
||||
goto report_outcome;
|
||||
|
||||
if(!((xorriso->ino_behavior & 2) || (flag & 16) ||
|
||||
xorriso->di_array != NULL)) {
|
||||
/* Create all-image node array sorted by isofs.di */
|
||||
made_di_array= 1;
|
||||
ret= Xorriso_make_di_array(xorriso, 0);
|
||||
if(ret <= 0)
|
||||
goto ex;
|
||||
if(!(xorriso->ino_behavior & 2)) {
|
||||
if(!(xorriso->di_array != NULL || (flag & 16))) {
|
||||
/* Create all-image node array sorted by isofs.di */
|
||||
made_di_array= 1;
|
||||
ret= Xorriso_make_di_array(xorriso, 0);
|
||||
if(ret <= 0)
|
||||
goto ex;
|
||||
}
|
||||
if(xorriso->di_array != NULL) {
|
||||
if(!(flag & 8)) {
|
||||
/* If directory with -update : do not register di_*_paths */
|
||||
ret= lstat(eff_origin, &stbuf);
|
||||
if(ret != -1)
|
||||
if(S_ISDIR(stbuf.st_mode))
|
||||
do_register= 0;
|
||||
}
|
||||
if(do_register) {
|
||||
ret= Xorriso_lst_append_binary(&(xorriso->di_disk_paths), eff_origin,
|
||||
strlen(eff_origin) + 1, 0);
|
||||
if(ret <= 0)
|
||||
goto ex;
|
||||
ret= Xorriso_lst_append_binary(&(xorriso->di_iso_paths), eff_dest,
|
||||
strlen(eff_dest) + 1, 0);
|
||||
if(ret <= 0)
|
||||
goto ex;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(flag&8) {
|
||||
@ -18703,7 +18743,7 @@ report_outcome:;
|
||||
ex:;
|
||||
if(made_di_array) {
|
||||
/* Dispose all-image node array sorted by isofs.di */
|
||||
Xorriso_destroy_di_array(xorriso, 0);
|
||||
Xorriso_finish_hl_update(xorriso, 0);
|
||||
}
|
||||
if(ret < 0)
|
||||
return(ret);
|
||||
|
Reference in New Issue
Block a user