Emitting SORRY event for dangling symbolic links if -follow is set to "link"
This commit is contained in:
parent
72ef04a9e1
commit
fc03217d91
@ -1,7 +1,7 @@
|
||||
|
||||
/* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images.
|
||||
|
||||
Copyright 2007-2022 Thomas Schmitt, <scdbackup@gmx.net>
|
||||
Copyright 2007-2023 Thomas Schmitt, <scdbackup@gmx.net>
|
||||
|
||||
Provided under GPL version 2 or later.
|
||||
|
||||
@ -300,11 +300,14 @@ unrecognizable:;
|
||||
|
||||
/* @param flag bit0= for Xorriso_msgs_submit: use pager
|
||||
bit1= do not issue warnings
|
||||
bit2= warn about dangling link
|
||||
bit3= report sorry if dangling link
|
||||
*/
|
||||
int Xorriso_hop_link(struct XorrisO *xorriso, char *link_path,
|
||||
struct LinkiteM **link_stack, struct stat *stbuf, int flag)
|
||||
{
|
||||
int ret;
|
||||
char *severity;
|
||||
struct LinkiteM *litm;
|
||||
|
||||
if(*link_stack != NULL) {
|
||||
@ -318,8 +321,19 @@ int Xorriso_hop_link(struct XorrisO *xorriso, char *link_path,
|
||||
}
|
||||
}
|
||||
ret= stat(link_path, stbuf);
|
||||
if(ret==-1)
|
||||
if(ret == -1) {
|
||||
if(flag & (4 | 8)) {
|
||||
if(flag & 8)
|
||||
severity= "SORRY";
|
||||
else
|
||||
severity= "WARNING";
|
||||
sprintf(xorriso->info_text, "Non-existing link target with : ");
|
||||
Text_shellsafe(link_path, xorriso->info_text, 1);
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, severity,
|
||||
flag & 1);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
ret= Linkitem_find(*link_stack, stbuf->st_dev, stbuf->st_ino, &litm, 0);
|
||||
if(ret>0) {
|
||||
sprintf(xorriso->info_text, "Detected symbolic link loop around : ");
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
/* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images.
|
||||
|
||||
Copyright 2007-2022 Thomas Schmitt, <scdbackup@gmx.net>
|
||||
Copyright 2007-2023 Thomas Schmitt, <scdbackup@gmx.net>
|
||||
|
||||
Provided under GPL version 2 or later.
|
||||
|
||||
@ -490,7 +490,7 @@ cannot_lstat:;
|
||||
source_is_link= S_ISLNK(stbuf.st_mode);
|
||||
if(xorriso->do_follow_links && source_is_link) {
|
||||
/* Xorriso_hop_link checks for wide link loops */
|
||||
ret= Xorriso_hop_link(xorriso, srcpt, &own_link_stack, &hstbuf, 0);
|
||||
ret= Xorriso_hop_link(xorriso, srcpt, &own_link_stack, &hstbuf, 8);
|
||||
if(ret<0)
|
||||
goto was_problem;
|
||||
if(ret==1) {
|
||||
@ -502,6 +502,7 @@ cannot_lstat:;
|
||||
if(lstat(srcpt, &stbuf)==-1)
|
||||
goto cannot_lstat;
|
||||
} else {
|
||||
Xorriso_msgs_submit(xorriso, 0, srcpt, 0, "ERRFILE", 0);
|
||||
if(Xorriso_eval_problem_status(xorriso, 0, 1|2)<0)
|
||||
{ret= 0; goto was_problem;}
|
||||
ret= Xorriso_resolve_link(xorriso, srcpt, link_target, 1);
|
||||
|
@ -1 +1 @@
|
||||
#define Xorriso_timestamP "2023.02.28.150706"
|
||||
#define Xorriso_timestamP "2023.03.15.194905"
|
||||
|
Loading…
Reference in New Issue
Block a user