+ return;
+
+ if (flock(lock_fd, LOCK_UN))
+ warn("Cannot release exclusive lock: %s", strerror(errno));
+
+ close(lock_fd);
+ unlink(FW3_LOCKFILE);
+
+ lock_fd = -1;
+}
+
+
+bool fw3_has_state(void)
+{
+ struct stat s;
+ return !stat(FW3_STATEFILE, &s);
+}
+
+void fw3_write_state(void *state)
+{
+ int fd;
+ struct fw3_state *s = state;
+ struct fw3_zone *z;
+ struct fw3_ipset *i;
+
+ fd = open(FW3_STATEFILE, O_CREAT|O_EXCL|O_WRONLY, S_IRUSR|S_IWUSR);
+
+ if (fd < 0)