main: clarify nosyslog code path
Split the block up and add a comment why notifypid is important.
This commit is contained in:
parent
434ce50db3
commit
45dfc90a2f
9
main.go
9
main.go
@ -271,17 +271,18 @@ func main() {
|
|||||||
tlog.Debug.Printf("cli args: %v", args)
|
tlog.Debug.Printf("cli args: %v", args)
|
||||||
srv := initFuseFrontend(masterkey, args, confFile)
|
srv := initFuseFrontend(masterkey, args, confFile)
|
||||||
tlog.Info.Println(tlog.ColorGreen + "Filesystem mounted and ready." + tlog.ColorReset)
|
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 {
|
if args.notifypid > 0 {
|
||||||
sendUsr1(args.notifypid)
|
sendUsr1(args.notifypid)
|
||||||
|
}
|
||||||
if !args.nosyslog {
|
// 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.Info.SwitchToSyslog(syslog.LOG_USER | syslog.LOG_INFO)
|
||||||
tlog.Debug.SwitchToSyslog(syslog.LOG_USER | syslog.LOG_DEBUG)
|
tlog.Debug.SwitchToSyslog(syslog.LOG_USER | syslog.LOG_DEBUG)
|
||||||
tlog.Warn.SwitchToSyslog(syslog.LOG_USER | syslog.LOG_WARNING)
|
tlog.Warn.SwitchToSyslog(syslog.LOG_USER | syslog.LOG_WARNING)
|
||||||
tlog.SwitchLoggerToSyslog(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.
|
// Wait for SIGINT in the background and unmount ourselves if we get it.
|
||||||
// This prevents a dangling "Transport endpoint is not connected" mountpoint.
|
// This prevents a dangling "Transport endpoint is not connected" mountpoint.
|
||||||
handleSigint(srv, args.mountpoint)
|
handleSigint(srv, args.mountpoint)
|
||||||
|
Loading…
Reference in New Issue
Block a user