mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-28 17:04:41 +00:00
Add missing error handling in getAppFilename (#25017)
readlink can return -1, e.g. if procfs isn't mounted in a Linux chroot.
(At least that's how I found this.)
(cherry picked from commit b6491e7de5)
This commit is contained in:
@@ -565,6 +565,8 @@ when not weirdTarget and (defined(linux) or defined(solaris) or defined(bsd) or
|
||||
if len > maxSymlinkLen:
|
||||
result = newString(len+1)
|
||||
len = readlink(procPath, result.cstring, len)
|
||||
if len < 0: # error in readlink
|
||||
len = 0
|
||||
setLen(result, len)
|
||||
|
||||
when not weirdTarget and defined(openbsd):
|
||||
|
||||
Reference in New Issue
Block a user