aboutsummaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2015-11-09 23:21:11 +0100
committerJakob Unterwurzacher2015-11-09 23:33:35 +0100
commit51fcf61630905f5dc9370e18522cd0a6c086856d (patch)
tree28fb05508d5c7227b07e01d20360b98e14606473 /main.go
parent273d8086aefdcdbd361d9be31d362b128a3f60f4 (diff)
Use new arg "-notifypid" for more robust daemonization
No more string matching on the parent command line!
Diffstat (limited to 'main.go')
-rw-r--r--main.go10
1 files changed, 6 insertions, 4 deletions
diff --git a/main.go b/main.go
index d848f90..e3acb3c 100644
--- a/main.go
+++ b/main.go
@@ -68,7 +68,7 @@ type argContainer struct {
plaintextnames, quiet bool
masterkey, mountpoint, cipherdir string
cpuprofile *string
- sendusr1 int
+ notifypid int
}
var flagSet *flag.FlagSet
@@ -93,7 +93,7 @@ func main() {
flagSet.BoolVar(&args.quiet, "q", false, "Quiet - silence informational messages")
flagSet.StringVar(&args.masterkey, "masterkey", "", "Mount with explicit master key")
args.cpuprofile = flagSet.String("cpuprofile", "", "Write cpu profile to specified file")
- flagSet.IntVar(&args.sendusr1, "sendusr1", 0,
+ flagSet.IntVar(&args.notifypid, "notifypid", 0,
"Send USR1 to the specified process after successful mount - used internally for daemonization")
flagSet.Parse(os.Args[1:])
if args.version {
@@ -221,8 +221,10 @@ func main() {
}
cryptfs.Info.Println("Filesystem ready.")
- // Send notification to our parent
- sendUsr1()
+ // Send USR1 notification
+ if args.notifypid > 0 {
+ sendUsr1(args.notifypid)
+ }
// Wait for SIGING in the background and unmount ourselves if we get it
// This prevents a dangling "Transport endpoint is not connected" mountpoint
handleSigint(srv, args.mountpoint)