File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -73,6 +73,11 @@ func (s *vfsShm) shmOpen() _ErrorCode {
73
73
return _OK
74
74
}
75
75
76
+ var f * os.File
77
+ // Close file on error.
78
+ // Keep this here to avoid confusing checklocks.
79
+ defer func () { f .Close () }()
80
+
76
81
vfsShmListMtx .Lock ()
77
82
defer vfsShmListMtx .Unlock ()
78
83
@@ -93,13 +98,11 @@ func (s *vfsShm) shmOpen() _ErrorCode {
93
98
}
94
99
95
100
// Always open file read-write, as it will be shared.
96
- f , err : = os .OpenFile (s .path ,
101
+ f , err = os .OpenFile (s .path ,
97
102
os .O_RDWR | os .O_CREATE | _O_NOFOLLOW , 0666 )
98
103
if err != nil {
99
104
return _CANTOPEN
100
105
}
101
- // Closes file if it's not nil.
102
- defer func () { f .Close () }()
103
106
104
107
// Dead man's switch.
105
108
if lock , rc := osTestLock (f , _SHM_DMS , 1 ); rc != _OK {
You can’t perform that action at this time.
0 commit comments