summaryrefslogtreecommitdiff
path: root/src/nshd/hackers_git/hackers_watch.go
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2015-09-11 23:21:50 -0600
committerLuke Shumaker <lukeshu@sbcglobal.net>2015-09-11 23:21:50 -0600
commit5e781d7539ac8f1f17e6cfa04c3c28fdfe65f4db (patch)
tree67bb7e9f34221a9baa49f6e9d6ac71342cc7836e /src/nshd/hackers_git/hackers_watch.go
parenteed575704b9277b71fb85846cb16dfa94549465c (diff)
Have nslcd_systemd manage the backend lifecycle
Diffstat (limited to 'src/nshd/hackers_git/hackers_watch.go')
-rw-r--r--src/nshd/hackers_git/hackers_watch.go15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/nshd/hackers_git/hackers_watch.go b/src/nshd/hackers_git/hackers_watch.go
index 8e3834e..919a578 100644
--- a/src/nshd/hackers_git/hackers_watch.go
+++ b/src/nshd/hackers_git/hackers_watch.go
@@ -62,9 +62,9 @@ func (o *Hackers) reload() (err error) {
o.close()
o.in_fd, err = inotify.InotifyInit() ; if err != nil { return }
o.in_wd_home, err = o.in_fd.AddWatch("/home" , in_DIR|in_CHILD_ADD); if err != nil { return }
- o.in_wd_yaml, err = o.in_fd.AddWatch(o.cfg.Yamldir, in_DIR|in_CHILD_ANY); if err != nil { return }
+ o.in_wd_yaml, err = o.in_fd.AddWatch(o.Cfg.Yamldir, in_DIR|in_CHILD_ANY); if err != nil { return }
- filenames, err := filepath.Glob(o.cfg.Yamldir + "/*.yml")
+ filenames, err := filepath.Glob(o.Cfg.Yamldir + "/*.yml")
o.users = make(map[int32]user, len(filenames))
o.groups = make(map[string]map[string]bool)
o.in_uid2wd = make(map[int32]inotify.Wd, len(filenames))
@@ -152,9 +152,9 @@ func worker_error(format string, a ...interface{}) {
}
func (o *Hackers) worker() {
- err := os.Chdir(o.cfg.Yamldir)
+ err := os.Chdir(o.Cfg.Yamldir)
if err != nil {
- worker_error("failed to load %q: %v", o.cfg.Yamldir, err)
+ worker_error("failed to load %q: %v", o.Cfg.Yamldir, err)
}
for event, err := o.in_fd.Read(); err == nil; event, err = o.in_fd.Read() {
switch event.Wd {
@@ -166,16 +166,15 @@ func (o *Hackers) worker() {
worker_error("failed to reload hackers.git yaml directory: %v", err)
}
- err = os.Chdir(o.cfg.Yamldir)
+ err = os.Chdir(o.Cfg.Yamldir)
if err != nil {
- worker_error("failed to load %q: %v", o.cfg.Yamldir, err)
+ worker_error("failed to load %q: %v", o.Cfg.Yamldir, err)
}
} else if event.Mask&in_CHILD_ANY != 0 {
if event.Name == nil {
panic("recieved child event from inotify, but no child name")
}
- filename := o.cfg.Yamldir + "/" + *event.Name
- o.load_yaml_file(filename)
+ o.load_yaml_file(o.Cfg.Yamldir + "/" + *event.Name, true)
} else {
panic("recieved non-subscribed inotify event from kernel")
}