File: portal-fix-the-strcmps-on-the-cgroup-hierarchies.patch

package info (click to toggle)
libportal 0.6-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,280 kB
  • sloc: ansic: 7,646; javascript: 670; cpp: 463; sh: 162; makefile: 36; xml: 20
file content (33 lines) | stat: -rw-r--r-- 1,226 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
From: Peter Hutterer <peter.hutterer@who-t.net>
Date: Thu, 30 Jun 2022 14:06:32 +1000
Subject: portal: fix the strcmps on the cgroup hierarchies

Fixes

../libportal/portal.c:344:12: warning: logical not is only applied
to the left hand side of this comparison [-Wlogical-not-parentheses]
           !strcmp (controller, ":") != 0) &&

Origin: upstream, 0.7, commit:4a0f893a96eba958f91032ce33f9aca543052f00
---
 libportal/portal.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/libportal/portal.c b/libportal/portal.c
index 5e72089..32a34d7 100644
--- a/libportal/portal.c
+++ b/libportal/portal.c
@@ -304,9 +304,10 @@ _xdp_parse_cgroup_file (FILE *f, gboolean *is_snap)
 
       /* Only consider the freezer, systemd group or unified cgroup
        * hierarchies */
-      if ((!strcmp (controller, "freezer:") != 0 ||
-           !strcmp (controller, "name=systemd:") != 0 ||
-           !strcmp (controller, ":") != 0) &&
+      if (controller != NULL &&
+          (g_str_equal (controller, "freezer:") ||
+           g_str_equal (controller, "name=systemd:") ||
+           g_str_equal (controller, ":")) &&
           strstr (cgroup, "/snap.") != NULL)
         {
           *is_snap = TRUE;