MCPcopy Create free account
hub / github.com/LemonOSProject/LemonOS / FollowLink

Function FollowLink

Kernel/src/fs/filesystem.cpp:47–65  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

45 }
46
47 FsNode* FollowLink(FsNode* link, FsNode* workingDir){
48 assert(link);
49
50 char buffer[PATH_MAX + 1];
51
52 auto bytesRead = link->ReadLink(buffer, PATH_MAX);
53 if(bytesRead < 0){
54 Log::Warning("FollowLink: Readlink error %d", -bytesRead);
55 return nullptr;
56 }
57 buffer[bytesRead] = 0; // Null terminate
58
59 FsNode* node = ResolvePath(buffer, workingDir, false);
60
61 if(!node){
62 Log::Warning("FollowLink: Failed to resolve symlink %s!", buffer);
63 }
64 return node;
65 }
66
67 FsNode* ResolvePath(const char* path, const char* workingDir, bool followSymlinks){
68 assert(path);

Callers 1

ResolvePathFunction · 0.85

Calls 3

WarningFunction · 0.85
ResolvePathFunction · 0.85
ReadLinkMethod · 0.45

Tested by

no test coverage detected