mirror of
https://github.com/glfw/glfw.git
synced 2026-09-21 00:30:57 +00:00
+11
-2
@@ -160,15 +160,24 @@ GLFWbool _glfwInitJoysticksLinux(void)
|
||||
|
||||
while ((entry = readdir(dir)))
|
||||
{
|
||||
char path[20];
|
||||
regmatch_t match;
|
||||
char* path = NULL;
|
||||
|
||||
if (regexec(&_glfw.linjs.regex, entry->d_name, 1, &match, 0) != 0)
|
||||
continue;
|
||||
|
||||
snprintf(path, sizeof(path), "%s/%s", dirname, entry->d_name);
|
||||
if (asprintf(&path, "%s/%s", dirname, entry->d_name) < 0)
|
||||
{
|
||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||
"Linux: Failed to construct device path: %s",
|
||||
strerror(errno));
|
||||
continue;
|
||||
}
|
||||
|
||||
if (openJoystickDevice(path))
|
||||
count++;
|
||||
|
||||
free(path);
|
||||
}
|
||||
|
||||
closedir(dir);
|
||||
|
||||
Reference in New Issue
Block a user