Fix bug #2982 'variable declaration behind FLOCK conditional'