aboutsummaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2016-10-07 00:05:46 +0200
committerJakob Unterwurzacher2016-10-07 00:05:46 +0200
commit45dfc90a2f96517917baa81829e79e0970ccc421 (patch)
treeb21bcf798354a9d848616572a59ff095b2771592 /main.go
parent434ce50db38e78f7e2a67af07cb92d8829fdfdf6 (diff)
main: clarify nosyslog code path
Split the block up and add a comment why notifypid is important.
Diffstat (limited to 'main.go')
-rw-r--r--main.go17
1 files changed, 9 insertions, 8 deletions
diff --git a/main.go b/main.go
index c71e289..da2b850 100644
--- a/main.go
+++ b/main.go
@@ -271,16 +271,17 @@ func main() {
tlog.Debug.Printf("cli args: %v", args)
srv := initFuseFrontend(masterkey, args, confFile)
tlog.Info.Println(tlog.ColorGreen + "Filesystem mounted and ready." + tlog.ColorReset)
- // We are ready - send USR1 signal to our parent and switch to syslog
+ // We are ready - send USR1 signal to our parent
if args.notifypid > 0 {
sendUsr1(args.notifypid)
-
- if !args.nosyslog {
- tlog.Info.SwitchToSyslog(syslog.LOG_USER | syslog.LOG_INFO)
- tlog.Debug.SwitchToSyslog(syslog.LOG_USER | syslog.LOG_DEBUG)
- tlog.Warn.SwitchToSyslog(syslog.LOG_USER | syslog.LOG_WARNING)
- tlog.SwitchLoggerToSyslog(syslog.LOG_USER | syslog.LOG_WARNING)
- }
+ }
+ // If we have been forked into the background, as evidenced by the set
+ // "notifypid", switch to syslog. Unless "nosyslog" is set.
+ if args.notifypid > 0 && !args.nosyslog {
+ tlog.Info.SwitchToSyslog(syslog.LOG_USER | syslog.LOG_INFO)
+ tlog.Debug.SwitchToSyslog(syslog.LOG_USER | syslog.LOG_DEBUG)
+ tlog.Warn.SwitchToSyslog(syslog.LOG_USER | syslog.LOG_WARNING)
+ tlog.SwitchLoggerToSyslog(syslog.LOG_USER | syslog.LOG_WARNING)
}
// Wait for SIGINT in the background and unmount ourselves if we get it.
// This prevents a dangling "Transport endpoint is not connected" mountpoint.