diff options
author | David Härdeman <david@hardeman.nu> | 2020-07-12 14:04:40 +0200 |
---|---|---|
committer | David Härdeman <david@hardeman.nu> | 2020-07-12 14:04:40 +0200 |
commit | 6586ea650597ae0563c4234a7658499ce1e0117b (patch) | |
tree | be99b63c29a21b2492a35d0bc9cd2ade93388405 /minecproxy/server-config.c | |
parent | 714c267f5e4af98fd986c3563fc0e8e82a3dae1f (diff) |
Teach minecproxy to use same dirs as minecctl, step 1
Diffstat (limited to 'minecproxy/server-config.c')
-rw-r--r-- | minecproxy/server-config.c | 13 |
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); } |