File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,8 @@ static void getExePath(FFPlatform* platform)
21
21
char exePath [PATH_MAX + 1 ];
22
22
#ifdef __linux__
23
23
ssize_t exePathLen = readlink ("/proc/self/exe" , exePath , sizeof (exePath ) - 1 );
24
- exePath [exePathLen ] = '\0' ;
24
+ if (exePathLen >= 0 )
25
+ exePath [exePathLen ] = '\0' ;
25
26
#elif defined(__APPLE__ )
26
27
int exePathLen = proc_pidpath ((int ) getpid (), exePath , sizeof (exePath ));
27
28
#elif defined(__FreeBSD__ ) || defined(__NetBSD__ )
@@ -44,7 +45,8 @@ static void getExePath(FFPlatform* platform)
44
45
size_t exePathLen = 0 ;
45
46
#elif defined(__sun )
46
47
ssize_t exePathLen = readlink ("/proc/self/path/a.out" , exePath , sizeof (exePath ) - 1 );
47
- exePath [exePathLen ] = '\0' ;
48
+ if (exePathLen >= 0 )
49
+ exePath [exePathLen ] = '\0' ;
48
50
#endif
49
51
if (exePathLen > 0 )
50
52
{
You can’t perform that action at this time.
0 commit comments