Skip to content

Commit

Permalink
selinux: improve comment about getcon_raw semantics
Browse files Browse the repository at this point in the history
This code was changed in this pull request:
#16571

After some discussion and more investigation, we better understand
what's going on. So, update the comment, so things are more clear
to future readers.
  • Loading branch information
CmdrMoozy authored and poettering committed Aug 5, 2020
1 parent 3f449f2 commit a119185
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/core/selinux-setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@ int mac_selinux_setup(bool *loaded_policy) {

/* Already initialized by somebody else? */
r = getcon_raw(&con);
/* getcon_raw can return 0, and still give us a NULL pointer. */
/* getcon_raw can return 0, and still give us a NULL pointer if
* /proc/self/attr/current is empty. SELinux guarantees this won't
* happen, but that file isn't specific to SELinux, and may be provided
* by some other arbitrary LSM with different semantics. */
if (r == 0 && con) {
initialized = !streq(con, "kernel");
freecon(con);
Expand Down

0 comments on commit a119185

Please sign in to comment.