aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLibravatar Kelvin M. Klann <kmk3.code@protonmail.com>2023-11-14 15:12:08 -0300
committerLibravatar Kelvin M. Klann <kmk3.code@protonmail.com>2023-12-05 11:41:13 -0300
commit24b88ce3a271f438c2fd9ea477afa3e212280c0d (patch)
tree03ec4b8cf081a1ff90cd10c12bb4c230bd7b50b5 /src
parentlandlock: stop setting global ruleset in ll_create_full_ruleset (diff)
downloadfirejail-24b88ce3a271f438c2fd9ea477afa3e212280c0d.tar.gz
firejail-24b88ce3a271f438c2fd9ea477afa3e212280c0d.tar.zst
firejail-24b88ce3a271f438c2fd9ea477afa3e212280c0d.zip
landlock: simplify variables in ll_add_profile
This amends commit 520508d5b ("landlock: avoid parsing landlock commands twice", 2023-11-02) / PR #6078.
Diffstat (limited to 'src')
-rw-r--r--src/firejail/landlock.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/firejail/landlock.c b/src/firejail/landlock.c
index 64d10b914..163804053 100644
--- a/src/firejail/landlock.c
+++ b/src/firejail/landlock.c
@@ -342,16 +342,15 @@ void ll_add_profile(int type, const char *data) {
342 if (!ll_is_supported()) 342 if (!ll_is_supported())
343 return; 343 return;
344 344
345 const char *str = data; 345 while (*data == ' ' || *data == '\t')
346 while (*str == ' ' || *str == '\t') 346 data++;
347 str++;
348 347
349 LandlockEntry *ptr = malloc(sizeof(LandlockEntry)); 348 LandlockEntry *ptr = malloc(sizeof(LandlockEntry));
350 if (!ptr) 349 if (!ptr)
351 errExit("malloc"); 350 errExit("malloc");
352 memset(ptr, 0, sizeof(LandlockEntry)); 351 memset(ptr, 0, sizeof(LandlockEntry));
353 ptr->type = type; 352 ptr->type = type;
354 ptr->data = strdup(str); 353 ptr->data = strdup(data);
355 if (!ptr->data) 354 if (!ptr->data)
356 errExit("strdup"); 355 errExit("strdup");
357 ptr->next = cfg.lprofile; 356 ptr->next = cfg.lprofile;