diff options
| author | Michael Vogt <mvo@ubuntu.com> | 2018-03-23 09:33:22 +0100 |
|---|---|---|
| committer | Michael Vogt <mvo@ubuntu.com> | 2018-03-23 09:33:22 +0100 |
| commit | bc24c87e9d1eed5b8dedd121454c38eed630d334 (patch) | |
| tree | c662d151996f547d9e7101d0e2b219c91e32b9ae | |
| parent | 9ea2acd4e561622d0cb85c78324a17b90266f143 (diff) | |
advisor: add comment why osutil.FileExists(dirs.SnapCommandsDB) is neededfinder-robustness-comments
| -rw-r--r-- | advisor/backend.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/advisor/backend.go b/advisor/backend.go index 99a5cf01e9..bde83db353 100644 --- a/advisor/backend.go +++ b/advisor/backend.go @@ -190,6 +190,10 @@ type boltFinder struct { // Open the database for reading. func Open() (Finder, error) { + // Check for missing file manually to workaround bug in bolt. + // bolt.Open() is using os.OpenFile(.., os.O_RDONLY | + // os.O_CREATE) even if ReadOnly mode is used. So we would get + // a misleading "permission denied" error without this check. if !osutil.FileExists(dirs.SnapCommandsDB) { return nil, os.ErrNotExist } |
