commit cbc149c7ed1472a83093733344135889e7eae925
parent c38b77d0c085734335f287bca319b73206c9dd7a
Author: Denis Kenzior <denkenz@gmail.com>
Date: Fri, 10 Aug 2018 12:13:47 -0500
knownnetworks: Avoid unnecessary known object removal
Due to the quirk in how storage_network_sync implements file writing,
iwd was generating unnecessary KnownNetwork removal events (and
preventing certain test cases from passing successfully)
storage_network_sync tries to perform atomic writes by writing to a
temporary storage location first, unlinking the existing file and
renaming the tmp file as the original.
This generates a set of inotify events which confuses the current
implementation.
Diffstat:
1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/src/knownnetworks.c b/src/knownnetworks.c
@@ -319,19 +319,14 @@ static void known_networks_watch_cb(struct l_fswatch *watch,
switch (event) {
case L_FSWATCH_EVENT_DELETE:
- if (network_before)
- known_network_removed(network_before);
-
- break;
-
case L_FSWATCH_EVENT_MOVE:
case L_FSWATCH_EVENT_MODIFY:
case L_FSWATCH_EVENT_ATTRIB:
case L_FSWATCH_EVENT_CREATE:
/*
- * Any of the four operations may result in the removal
- * of the network (file moved out, not readable or
- * invalid) or the creation of a new network (file
+ * For now treat all the operations the same. E.g. they may
+ * result in the removal of the network (file moved out, not
+ * readable or invalid) or the creation of a new network (file
* created, permissions granted, syntax fixed, etc.)
* so we always need to re-read the file.
*/