summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2009-04-23 09:04:38 +0100
committerMarcel Holtmann <marcel@holtmann.org>2009-04-23 09:04:38 +0100
commit4a6714894c506c1f4be0031dbc08662fca6a240c (patch)
tree8ddc4fe3f64a6115c2e22392af244b3ae7130d4e
parenteb0286572813ca040954e6a54eb18e2683415072 (diff)
downloadconnman-4a6714894c506c1f4be0031dbc08662fca6a240c.tar.gz
connman-4a6714894c506c1f4be0031dbc08662fca6a240c.tar.bz2
connman-4a6714894c506c1f4be0031dbc08662fca6a240c.zip
Register inotify watch only if setup succeeds
-rw-r--r--plugins/loopback.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/plugins/loopback.c b/plugins/loopback.c
index 04bd7a1c..deaaac27 100644
--- a/plugins/loopback.c
+++ b/plugins/loopback.c
@@ -101,9 +101,6 @@ static int create_watch(void)
return -EIO;
}
- g_io_add_watch(inotify_channel, G_IO_IN | G_IO_ERR | G_IO_HUP,
- inotify_event, NULL);
-
hostname_descriptor = inotify_add_watch(fd, "/etc/hostname",
IN_MODIFY | IN_DELETE_SELF | IN_MOVE_SELF);
if (hostname_descriptor < 0) {
@@ -114,6 +111,9 @@ static int create_watch(void)
return -EIO;
}
+ g_io_add_watch(inotify_channel, G_IO_IN | G_IO_ERR | G_IO_HUP,
+ inotify_event, NULL);
+
return 0;
}