(stateFile string)
| 156 | if err != nil { |
| 157 | log.Warningf("unable to open repo lock %s: %v", path, err) |
| 158 | return nil |
| 159 | } |
| 160 | if err := syscall.Flock(int(f.Fd()), syscall.LOCK_SH); err != nil { |
| 161 | log.Warningf("unable to lock repo lock %s: %v", path, err) |
| 162 | _ = f.Close() |
| 163 | return nil |
| 164 | } |
| 165 | return f |
| 166 | } |
| 167 | |
| 168 | // unlockRepo releases a lock taken by lockRepoShared. Closing the descriptor drops |
| 169 | // the flock, so a nil file (lock never acquired) is a no-op. |
| 170 | func unlockRepo(f *os.File) { |
| 171 | if f == nil { |
| 172 | return |
| 173 | } |
| 174 | _ = f.Close() |
| 175 | } |
| 176 |
no outgoing calls
no test coverage detected