MCPcopy Create free account
hub / github.com/abbeycode/UnrarKit / ExtractUnixLink50

Function ExtractUnixLink50

Libraries/unrar/ulinks.cpp:84–105  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

82
83
84bool ExtractUnixLink50(CommandData *Cmd,const wchar *Name,FileHeader *hd)
85{
86 char Target[NM];
87 WideToChar(hd->RedirName,Target,ASIZE(Target));
88 if (hd->RedirType==FSREDIR_WINSYMLINK || hd->RedirType==FSREDIR_JUNCTION)
89 {
90 // Cannot create Windows absolute path symlinks in Unix. Only relative path
91 // Windows symlinks can be created here. RAR 5.0 used \??\ prefix
92 // for Windows absolute symlinks, since RAR 5.1 /??/ is used.
93 // We escape ? as \? to avoid "trigraph" warning
94 if (strncmp(Target,"\\??\\",4)==0 || strncmp(Target,"/\?\?/",4)==0)
95 return false;
96 DosSlashToUnix(Target,Target,ASIZE(Target));
97 }
98 // Use hd->FileName instead of LinkName, since LinkName can include
99 // the destination path as a prefix, which can confuse
100 // IsRelativeSymlinkSafe algorithm.
101 if (!Cmd->AbsoluteLinks && (IsFullPath(Target) ||
102 !IsRelativeSymlinkSafe(Cmd,hd->FileName,Name,hd->RedirName)))
103 return false;
104 return UnixSymlink(Target,Name,&hd->mtime,&hd->atime);
105}

Callers 1

ExtractSymlinkFunction · 0.85

Calls 5

WideToCharFunction · 0.85
DosSlashToUnixFunction · 0.85
IsRelativeSymlinkSafeFunction · 0.85
UnixSymlinkFunction · 0.85
IsFullPathFunction · 0.70

Tested by

no test coverage detected