changeset 108184:f4b0e5358091

* src/fileio.c (Ffile_selinux_context): Context functions may return null.
author Glenn Morris <rgm@gnu.org>
date Fri, 30 Apr 2010 19:58:41 -0700
parents b67d7273ec18
children 804e9ced8374
files src/ChangeLog src/fileio.c
diffstat 2 files changed, 12 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Fri Apr 30 22:19:40 2010 -0400
+++ b/src/ChangeLog	Fri Apr 30 19:58:41 2010 -0700
@@ -1,3 +1,7 @@
+2010-05-01  Karel Klíč  <kklic@redhat.com>
+
+	* fileio.c (Ffile_selinux_context): Context functions may return null.
+
 2010-04-30  Dan Nicolaescu  <dann@ics.uci.edu>
 
 	* s/gnu.h (POSIX_SIGNALS):
--- a/src/fileio.c	Fri Apr 30 22:19:40 2010 -0400
+++ b/src/fileio.c	Fri Apr 30 19:58:41 2010 -0700
@@ -2918,10 +2918,14 @@
       if (conlength > 0)
 	{
 	  context = context_new (con);
-	  values[0] = build_string (context_user_get (context));
-	  values[1] = build_string (context_role_get (context));
-	  values[2] = build_string (context_type_get (context));
-	  values[3] = build_string (context_range_get (context));
+	  if (context_user_get (context))
+	    values[0] = build_string (context_user_get (context));
+	  if (context_role_get (context))
+	    values[1] = build_string (context_role_get (context));
+	  if (context_type_get (context))
+	    values[2] = build_string (context_type_get (context));
+	  if (context_range_get (context))
+	    values[3] = build_string (context_range_get (context));
 	  context_free (context);
 	}
       if (con)