hal: Branch 'master' - 2 commits
Danny Kukawka
dkukawka at kemper.freedesktop.org
Thu Mar 6 10:49:22 PST 2008
tools/hal-acl-tool.c | 23 +++++++++++------------
1 file changed, 11 insertions(+), 12 deletions(-)
New commits:
commit 6f55096eaa340632d189002f4778cdb91c6684e9
Author: Lubomir Kundrak <lkundrak at redhat.com>
Date: Thu Mar 6 19:49:15 2008 +0100
move acl-list from /var/lib/hal/ to /var/run/hal
List of applied ACLs can get corrupted, and that prevents hal-acl-tool
from ever touching it again and fixing. If that was due to a crash, etc,
it is not valid any longer anyways. In that case probably it would make
sense to relocate /var/lib/hal/acl-list into /var/run/hal, and let it
be removed by operating system startup scripts.
Simple change that moves acl-list to /var/run from /var/lib, as FHS suggests:
> This directory contains system information data describing the system
> since it was booted. Files under this directory must be cleared
> (removed or truncated as appropriate) at the beginning of the boot
> process.
Note that packagers will probably want to move the acl list in post
installation scriptlet when updating.
diff --git a/tools/hal-acl-tool.c b/tools/hal-acl-tool.c
index f165aad..2f9a015 100644
--- a/tools/hal-acl-tool.c
+++ b/tools/hal-acl-tool.c
@@ -37,7 +37,7 @@
/* How this works (or "An introduction to this code")
*
- * - all ACL's granted by this tool is kept in /var/lib/hal/acl-list
+ * - all ACL's granted by this tool is kept in /var/run/hal/acl-list
* See below for the format.
*
* - every time tool is launched we read this file and keep each line
@@ -82,7 +82,7 @@
*
*/
-/* Each entry here represents a line in the /var/lib/hal/acl-list file
+/* Each entry here represents a line in the /var/run/hal/acl-list file
* of ACL's that have been set by HAL and as such are currently
* applied
*
@@ -220,7 +220,7 @@ acl_apply_changes (GSList *new_acl_list, gboolean only_update_acllist, gboolean
*
* The variable 'only_update_acllist' is set to TRUE only on
* device_remove events. It effectively means "only update the
- * /var/lib/hal/acl-list, do not apply ACL's on disk". So this
+ * /var/run/hal/acl-list, do not apply ACL's on disk". So this
* is done for systems where /dev is dynamic and we know for
* sure that the device file is gone.
*
@@ -258,7 +258,7 @@ acl_apply_changes (GSList *new_acl_list, gboolean only_update_acllist, gboolean
}
/* success; now atomically set the new list */
- g_file_set_contents (PACKAGE_LOCALSTATEDIR "/lib/hal/acl-list",
+ g_file_set_contents (PACKAGE_LOCALSTATEDIR "/run/hal/acl-list",
new_acl_file_contents,
strlen (new_acl_file_contents),
NULL);
@@ -360,9 +360,9 @@ get_current_acl_list (GSList **l)
f = NULL;
ret = FALSE;
- f = fopen (PACKAGE_LOCALSTATEDIR "/lib/hal/acl-list", "r");
+ f = fopen (PACKAGE_LOCALSTATEDIR "/run/hal/acl-list", "r");
if (f == NULL) {
- printf ("%d: cannot open " PACKAGE_LOCALSTATEDIR "/lib/hal/acl-list\n", getpid ());
+ printf ("%d: cannot open " PACKAGE_LOCALSTATEDIR "/run/hal/acl-list\n", getpid ());
goto out;
}
@@ -1154,11 +1154,11 @@ acl_lock (void)
if (lock_acl_fd >= 0)
return TRUE;
- printf ("%d: attempting to get lock on " PACKAGE_LOCALSTATEDIR "/lib/hal/acl-list\n", getpid ());
+ printf ("%d: attempting to get lock on " PACKAGE_LOCALSTATEDIR "/run/hal/acl-list\n", getpid ());
- lock_acl_fd = open (PACKAGE_LOCALSTATEDIR "/lib/hal/acl-list", O_CREAT | O_RDWR, 0644);
+ lock_acl_fd = open (PACKAGE_LOCALSTATEDIR "/run/hal/acl-list", O_CREAT | O_RDWR, 0644);
if (lock_acl_fd < 0) {
- printf ("%d: error opening/creating " PACKAGE_LOCALSTATEDIR "/lib/hal/acl-list\n", getpid ());
+ printf ("%d: error opening/creating " PACKAGE_LOCALSTATEDIR "/run/hal/acl-list\n", getpid ());
return FALSE;
}
@@ -1177,7 +1177,7 @@ tryagain:
printf ("\n");
printf ("****************************************************\n");
- printf ("%d: got lock on " PACKAGE_LOCALSTATEDIR "/lib/hal/acl-list\n", getpid ());
+ printf ("%d: got lock on " PACKAGE_LOCALSTATEDIR "/run/hal/acl-list\n", getpid ());
return TRUE;
}
@@ -1186,7 +1186,7 @@ acl_unlock (void)
{
printf ("\n");
printf ("****************************************************\n");
- printf ("%d: releasing lock on " PACKAGE_LOCALSTATEDIR "/lib/hal/acl-list\n", getpid ());
+ printf ("%d: releasing lock on " PACKAGE_LOCALSTATEDIR "/run/hal/acl-list\n", getpid ());
#if sun
lockf (lock_acl_fd, F_ULOCK, 0);
#else
commit 06af009fec26f728ac042caa641269be62f84fdc
Author: Lubomir Kundrak <lkundrak at redhat.com>
Date: Thu Mar 6 19:44:02 2008 +0100
apply ACLs even if acl list reading failed
List of applied ACLs can get corrupted, and that prevents hal-acl-tool
from ever touching it again and fixing. Trivial fix attached.
diff --git a/tools/hal-acl-tool.c b/tools/hal-acl-tool.c
index 16bede9..f165aad 100644
--- a/tools/hal-acl-tool.c
+++ b/tools/hal-acl-tool.c
@@ -803,7 +803,6 @@ acl_compute_changes (GSList *afd_list, gboolean only_update_acllist)
/* get the list of ACL's currently applied */
if (!get_current_acl_list (¤t_acl_list)) {
printf ("Error getting ACL's currently applied\n");
- goto out;
}
/* for each entry in ACLForDevice, we need to modify current_acl_list
More information about the hal-commit
mailing list