Skip to content

Commit 582b0fa

Browse files
committed
Monitor (Linux): prefer DRM
1 parent 0414128 commit 582b0fa

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/detection/monitor/monitor_linux.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ FF_MAYBE_UNUSED static const char* detectByDrm(FFlist* results)
176176
{
177177
const char* drmDirPath = "/sys/class/drm/";
178178

179-
DIR* dirp = opendir(drmDirPath);
179+
FF_AUTO_CLOSE_DIR DIR* dirp = opendir(drmDirPath);
180180
if(dirp == NULL)
181181
return "opendir(drmDirPath) == NULL";
182182

@@ -232,23 +232,23 @@ FF_MAYBE_UNUSED static const char* detectByDrm(FFlist* results)
232232
ffStrbufSubstrBefore(&drmDir, drmDirLength);
233233
}
234234

235-
closedir(dirp);
236235
return NULL;
237236
}
238237
#endif // __linux__
239238

240239
const char* ffDetectMonitor(FFlist* results)
241240
{
242-
const char* error = "Fastfetch was compiled without xrandr support";
241+
const char* error = NULL;
242+
243+
#if defined(__linux__)
244+
error = detectByDrm(results);
245+
if (!error && results->length > 0) return NULL;
246+
#endif
243247

244248
#ifdef FF_HAVE_XRANDR
245249
error = detectByXrandr(results);
246250
if (!error) return NULL;
247251
#endif
248252

249-
#if defined(__linux__)
250-
error = detectByDrm(results);
251-
#endif
252-
253-
return error;
253+
return "Fastfetch was compiled without xrandr support";
254254
}

0 commit comments

Comments
 (0)