File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -334,8 +334,21 @@ sentry__get_os_context(void)
334334 sentry_value_set_by_key (
335335 os , "version" , sentry_value_new_string (uts .release ));
336336
337+ /**
338+ * The file /etc/os-release takes precedence over /usr/lib/os-release.
339+ * Applications should check for the former, and exclusively use its data if
340+ * it exists, and only fall back to /usr/lib/os-release if it is missing.
341+ * Applications should not read data from both files at the same time.
342+ *
343+ * From: https://www.freedesktop.org/software/systemd/man/latest/os-release.html#Description
344+ */
337345 sentry_value_t os_dist = get_linux_os_release ("/etc/os-release" );
338- if (!sentry_value_is_null (os_dist )) {
346+ if (sentry_value_is_null (os_dist )) {
347+ os_dist = get_linux_os_release ("/usr/lib/os-release" );
348+ if (sentry_value_is_null (os_dist )) {
349+ sentry_value_set_by_key (os , "distribution" , os_dist );
350+ }
351+ } else {
339352 sentry_value_set_by_key (os , "distribution" , os_dist );
340353 }
341354
You can’t perform that action at this time.
0 commit comments