summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--internal/exitcodes/exitcodes.go21
-rw-r--r--mount.go10
2 files changed, 20 insertions, 11 deletions
diff --git a/internal/exitcodes/exitcodes.go b/internal/exitcodes/exitcodes.go
index 7a2efdb..cba74b6 100644
--- a/internal/exitcodes/exitcodes.go
+++ b/internal/exitcodes/exitcodes.go
@@ -8,12 +8,12 @@ import (
)
const (
- // Usage error: cli syntax etc
+ // Usage - usage error like wrong cli syntax, wrong number of parameters.
Usage = 1
// 2 is reserved because it is used by Go panic
+ // 3 is reserved because it was used by earlier gocryptfs version as a generic
+ // "mount" error.
- // Mount is an error on mount
- Mount = 3
// CipherDir means that the CIPHERDIR does not exist
CipherDir = 6
// Init is an error on filesystem init
@@ -26,7 +26,8 @@ const (
MountPoint = 10
// Other error - please inspect the message
Other = 11
- // PasswordIncorrect - the password was incorrect
+ // PasswordIncorrect - the password was incorrect when mounting or when
+ // changing the password.
PasswordIncorrect = 12
// ScryptParams means that scrypt was called with invalid parameters
ScryptParams = 13
@@ -35,12 +36,20 @@ const (
MasterKey = 14
// SigInt means we got SIGINT
SigInt = 15
- // PanicLog means the panic log was not empty when we were unmounted
- PanicLog = 16
+ // PanicLogNotEmpty means the panic log was not empty when we were unmounted
+ PanicLogNotEmpty = 16
// ForkChild means forking the worker child failed
ForkChild = 17
// OpenSSL means you tried to enable OpenSSL, but we were compiled without it.
OpenSSL = 18
+ // FuseNewServer - this exit code means that the call to fuse.NewServer failed.
+ // This usually means that there was a problem executing fusermount, or
+ // fusermount could not attach the mountpoint to the kernel.
+ FuseNewServer = 19
+ // CtlSock - the control socket file could not be created.
+ CtlSock = 20
+ // PanicLogCreate - there was a problem creating the /tmp/gocryptfs_paniclog.XYZ file.
+ PanicLogCreate = 21
)
// Err wraps an error with an associated numeric exit code
diff --git a/mount.go b/mount.go
index bcf056d..f8d220d 100644
--- a/mount.go
+++ b/mount.go
@@ -64,7 +64,7 @@ func doMount(args *argContainer) int {
sock, err = net.Listen("unix", args.ctlsock)
if err != nil {
tlog.Fatal.Printf("ctlsock: %v", err)
- os.Exit(exitcodes.Mount)
+ os.Exit(exitcodes.CtlSock)
}
args._ctlsockFd = sock
// Close also deletes the socket file
@@ -118,7 +118,7 @@ func doMount(args *argContainer) int {
paniclog, err = ioutil.TempFile("", "gocryptfs_paniclog.")
if err != nil {
tlog.Fatal.Printf("Failed to create gocryptfs_paniclog: %v", err)
- os.Exit(exitcodes.Mount)
+ os.Exit(exitcodes.PanicLogCreate)
}
// Switch all of our logs and the generic logger to syslog
tlog.Info.SwitchToSyslog(syslog.LOG_USER | syslog.LOG_INFO)
@@ -165,7 +165,7 @@ func doMount(args *argContainer) int {
} else if fi.Size() > 0 {
tlog.Warn.Printf("paniclog at %q is not empty (size %d). Not deleting it.",
paniclog.Name(), fi.Size())
- return exitcodes.PanicLog
+ return exitcodes.PanicLogNotEmpty
} else {
syscall.Unlink(paniclog.Name())
}
@@ -306,8 +306,8 @@ func initFuseFrontend(key []byte, args *argContainer, confFile *configfile.ConfF
}
srv, err := fuse.NewServer(conn.RawFS(), args.mountpoint, &mOpts)
if err != nil {
- tlog.Fatal.Printf("Mount failed: %v", err)
- os.Exit(exitcodes.Mount)
+ tlog.Fatal.Printf("fuse.NewServer failed: %v", err)
+ os.Exit(exitcodes.FuseNewServer)
}
srv.SetDebug(args.fusedebug)