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)
2121 char exePath [PATH_MAX + 1 ];
2222 #ifdef __linux__
2323 ssize_t exePathLen = readlink ("/proc/self/exe" , exePath , sizeof (exePath ) - 1 );
24- exePath [exePathLen ] = '\0' ;
24+ if (exePathLen >= 0 )
25+ exePath [exePathLen ] = '\0' ;
2526 #elif defined(__APPLE__ )
2627 int exePathLen = proc_pidpath ((int ) getpid (), exePath , sizeof (exePath ));
2728 #elif defined(__FreeBSD__ ) || defined(__NetBSD__ )
@@ -44,7 +45,8 @@ static void getExePath(FFPlatform* platform)
4445 size_t exePathLen = 0 ;
4546 #elif defined(__sun )
4647 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' ;
4850 #endif
4951 if (exePathLen > 0 )
5052 {
You can’t perform that action at this time.
0 commit comments