Refusing to apply -chattr to non-dir, non-regular files

This commit is contained in:
2024-08-07 15:26:09 +02:00
parent 58fb826c1d
commit c142b7b58f
7 changed files with 122 additions and 77 deletions

View File

@ -1832,6 +1832,11 @@ int Xorriso_option_chattri(struct XorrisO *xorriso, char *chattr_text,
for(i= 0; i<optc; i++) {
if(flag&1) {
/* Try out whether this file is suitable for chattr */
ret= Xorriso_set_lfa_flags(xorriso, NULL, optv[i], chattr_text,
lfa_flags, operator, 1 | 8);
if(ret <= 0 || ret == 2)
goto partial_failure;
ret= Findjob_new(&job, optv[i], 0);
if(ret<=0) {
Xorriso_no_findjob(xorriso, "-chattr_r", 0);
@ -1847,6 +1852,7 @@ int Xorriso_option_chattri(struct XorrisO *xorriso, char *chattr_text,
}
if(ret>0 && !xorriso->request_to_abort)
continue; /* regular bottom of loop */
partial_failure:;
was_failure= 1;
fret= Xorriso_eval_problem_status(xorriso, ret, 1|2);
if(fret>=0)