Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

cmount: catch panics in initialization and turn into error messages

Nick Craig-Wood306a3e0cd769
diff --git a/cmd/cmount/mount.go b/cmd/cmount/mount.go
index 5f33b9a19..a122f4863 100644
--- a/cmd/cmount/mount.go
+++ b/cmd/cmount/mount.go
@@ -158,6 +158,11 @@ func mount(VFS *vfs.VFS, mountpoint string, opt *mountlib.Options) (<-chan error
// Serve the mount point in the background returning error to errChan
errChan := make(chan error, 1)
go func() {
+ defer func() {
+ if r := recover(); r != nil {
+ errChan <- errors.Errorf("mount failed: %v", r)
+ }
+ }()
var err error
ok := host.Mount(mountpoint, options)
if !ok {