summaryrefslogtreecommitdiff
path: root/udev_rules_parse.c
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@suse.de>2005-08-08 05:07:36 +0200
committerKay Sievers <kay.sievers@suse.de>2005-08-08 05:07:36 +0200
commit63cc8f049100c9b76ca4e37fc5c8976b6e92a207 (patch)
tree7816e16d6e6239f7ee8222015fdb26a09f60d2f4 /udev_rules_parse.c
parent13d11705bf0117365afc3f9210f4d568a2baa69c (diff)
allow clean shutdown of udevd
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
Diffstat (limited to 'udev_rules_parse.c')
-rw-r--r--udev_rules_parse.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/udev_rules_parse.c b/udev_rules_parse.c
index 4580a779c6..cededf002d 100644
--- a/udev_rules_parse.c
+++ b/udev_rules_parse.c
@@ -650,10 +650,12 @@ int udev_rules_init(struct udev_rules *rules, int resolve_names)
void udev_rules_close(struct udev_rules *rules)
{
- if (rules->mapped)
- file_unmap(rules->buf, rules->bufsize);
- else
- free(rules->buf);
-
- rules->buf = NULL;
+ if (rules->buf) {
+ if (rules->mapped) {
+ rules->mapped = 0;
+ file_unmap(rules->buf, rules->bufsize);
+ } else
+ free(rules->buf);
+ rules->buf = NULL;
+ }
}