mirror of
https://github.com/SELinuxProject/selinux
synced 2025-02-17 18:16:52 +00:00
libselinux: restorecon: avoid printing NULL pointer
The variable `curcon` is NULL in case the file has no current security context. Most C standard libraries handle it fine, avoid it nonetheless for standard conformance. Signed-off-by: Christian Göttsche <cgzones@googlemail.com> Acked-by: Nicolas Iooss <nicolas.iooss@m4x.org>
This commit is contained in:
parent
8cc529af51
commit
956bda08f6
@ -744,7 +744,9 @@ static int restorecon_sb(const char *pathname, const struct stat *sb,
|
|||||||
selinux_log(SELINUX_INFO,
|
selinux_log(SELINUX_INFO,
|
||||||
"%s %s from %s to %s\n",
|
"%s %s from %s to %s\n",
|
||||||
updated ? "Relabeled" : "Would relabel",
|
updated ? "Relabeled" : "Would relabel",
|
||||||
pathname, curcon, newcon);
|
pathname,
|
||||||
|
curcon ? curcon : "<no context>",
|
||||||
|
newcon);
|
||||||
|
|
||||||
if (flags->syslog_changes && !flags->nochange) {
|
if (flags->syslog_changes && !flags->nochange) {
|
||||||
if (curcon)
|
if (curcon)
|
||||||
|
Loading…
Reference in New Issue
Block a user