Emitting SORRY event for dangling symbolic links if -follow is set to "link"
This commit is contained in:
@ -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 : ");
|
||||
|
Reference in New Issue
Block a user