libuser/libuser-0.56.18-matchpathcon.patch

31 lines
916 B
Diff
Raw Normal View History

Handle matchpathcon() failing with ENOENT.
2010-09-29 Miloslav Trmač <mitr@redhat.com>
* lib/util.c (lu_util_fscreate_for_path): Handle cases when a path is
not in the matchpathcon database.
diff -r cf42457692b4 -r 2744aecc92b1 lib/util.c
--- a/lib/util.c Mon Sep 27 19:27:26 2010 +0200
+++ b/lib/util.c Wed Sep 29 23:02:56 2010 +0200
@@ -756,10 +756,15 @@
security_context_t ctx;
if (matchpathcon(path, mode, &ctx) < 0) {
- lu_error_new(error, lu_error_stat,
- _("couldn't determine security context "
- "for `%s': %s"), path, strerror(errno));
- return FALSE;
+ if (errno == ENOENT)
+ ctx = NULL;
+ else {
+ lu_error_new(error, lu_error_stat,
+ _("couldn't determine security "
+ "context for `%s': %s"), path,
+ strerror(errno));
+ return FALSE;
+ }
}
if (setfscreatecon(ctx) < 0) {
lu_error_new(error, lu_error_generic,