MSM: Avoid creating empty access rule files 63/28363/1
authorJosé Bollo <jose.bollo@open.eurogiciel.org>
Fri, 3 Oct 2014 15:08:03 +0000 (17:08 +0200)
committerJosé Bollo <jose.bollo@open.eurogiciel.org>
Fri, 3 Oct 2014 15:08:03 +0000 (17:08 +0200)
commit1d272c2d0305c8c625b48f3339db1f6ff60b146c
tree9d3f0fed81b41929f127996c6a4ffeb6b54faa49
parent6af979ffe246fcc3c5286893f364a4691094beca
MSM: Avoid creating empty access rule files

The msm plugin creates one access rule file
in SMACK_RULES_PATH=/etc/smack/accesses.d for
each RPM installed.

Since Tizen 3, the guideline for packages is
simplified and the new guideline states that
manifest files have to be as simple as:

<manifest>
 <request>
    <domain name="_"/>
 </request>
</manifest>

It means that most access rule files are empty.

Thus, this patch removes the file if it is empty
because without any penality, it improves:
 - the start time of the system
 - the administration of the system

The start time is improved because at start, all
the files in /etc/smack/accesses.d are read and
loaded to the kernel. As empty files are just removed,
no time is spend to seek it, open it, read it, close it,
apply empty rule.

The administration is also improved because only meaning
access rule files are retains, avoid to have to sort what
is meaning and what is not.

Change-Id: I7b40f2b291f0c1dbcb2f033f62191c651430e3c8
Signed-off-by: José Bollo <jose.bollo@open.eurogiciel.org>
plugins/msmxattr.c