Skip to content

Commit 68c7ac9

Browse files
committed
Silence warning ignoring return value of readlink.
1 parent d59cd5f commit 68c7ac9

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

interpreter/cling/lib/Interpreter/DynamicLibraryManagerSymbol.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -277,11 +277,15 @@ static inline llvm::StringRef cached_readlink(const char* pathname) {
277277
return llvm::StringRef(it->second);
278278

279279
// If result not in cache - call system function and cache result
280-
char buf[PATH_MAX] = "\0";
281-
(void)readlink(pathname, buf, sizeof(buf));
282-
std::string sym(buf);
283-
readlink_cache.insert(std::pair<llvm::StringRef, std::string>(pathname, sym));
284-
return readlink_cache[pathname];
280+
char buf[PATH_MAX];
281+
ssize_t len;
282+
if ((len = readlink(pathname, buf, sizeof(buf))) != -1) {
283+
buf[len] = '\0';
284+
std::string s(buf);
285+
readlink_cache.insert(std::pair<llvm::StringRef, std::string>(pathname, s));
286+
return readlink_cache[pathname];
287+
}
288+
return "";
285289
}
286290
#endif
287291

0 commit comments

Comments
 (0)