Cleaned up udev-selinux patch

Luke Kenneth Casson Leighton lkcl at lkcl.net
Fri Aug 27 15:42:00 UTC 2004


On Fri, Aug 27, 2004 at 09:32:02AM -0400, Daniel J Walsh wrote:

> Further cleanup and using all static inlines versus defines.  Renamed a 
> couple of functions to make them clearer.
 
> +}
> +static inline void selinux_setfilecon(char *file, unsigned int mode) { 
> +	if (is_selinux_running()) {
> +		security_context_t scontext=NULL;
> +		if (matchpathcon(file, mode, &scontext) < 0) {
> +			dbg("matchpathcon(%s) failed\n", file);
> +		} else {
> +			
> +			if (setfilecon(file, scontext) < 0)
> +				dbg("setfiles %s failed with error '%s'",
> +				    file, strerror(errno));
> +			freecon(scontext);
> +		}
> +	}
> +}
> +
> +static inline void selinux_setfscreatecon(char *file, unsigned int mode) {
> +	int retval = 0;
> +	security_context_t scontext=NULL;
> +
> +	if (is_selinux_running()) {
> +		if (matchpathcon(file, S_IFDIR, &scontext) < 0) {
                               ^^^^^^^

	this should be matchpathcon(file, mode, &scontext)



More information about the fedora-selinux-list mailing list