summaryrefslogtreecommitdiff
path: root/minecproxy/server-config.c
diff options
context:
space:
mode:
Diffstat (limited to 'minecproxy/server-config.c')
-rw-r--r--minecproxy/server-config.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/minecproxy/server-config.c b/minecproxy/server-config.c
index 959f1d0..2e7f277 100644
--- a/minecproxy/server-config.c
+++ b/minecproxy/server-config.c
@@ -215,11 +215,10 @@ void server_cfg_monitor_init()
int ifd;
int iwd;
struct server_cfg_monitor *scfgm;
- DIR *dir;
struct dirent *dent;
struct server *server;
- assert_return(!cfg->server_cfg_monitor);
+ assert_return(!cfg->server_cfg_monitor && cfg->cfg_dir);
scfgm = zmalloc(sizeof(*scfgm));
if (!scfgm)
@@ -231,7 +230,7 @@ void server_cfg_monitor_init()
/* ln = IN_CREATE, cp/vi/mv = IN_CREATE, IN_OPEN, IN_CLOSE_WRITE */
iwd = inotify_add_watch(
- ifd, ".",
+ ifd, cfg->cfg_real_path,
IN_CLOSE_WRITE | IN_DELETE | IN_CREATE | IN_DELETE_SELF |
IN_MOVE_SELF | IN_MOVED_TO | IN_MOVED_FROM |
IN_DONT_FOLLOW | IN_EXCL_UNLINK | IN_ONLYDIR);
@@ -244,11 +243,7 @@ void server_cfg_monitor_init()
cfg->server_cfg_monitor = scfgm;
uring_read(&scfgm->task, scfgm->buf, sizeof(scfgm->buf), inotify_cb);
- dir = opendir(".");
- if (!dir)
- die("opendir(%s): %m", cfg->cfg_dir);
-
- while ((dent = readdir(dir)) != NULL) {
+ while ((dent = readdir(cfg->cfg_dir)) != NULL) {
if (!config_valid_server_filename(dent, NULL))
continue;
@@ -257,6 +252,4 @@ void server_cfg_monitor_init()
uring_openat(&server->task, server->scfg.filename,
server_cfg_open_cb);
}
-
- closedir(dir);
}