l_mktemp function: try lock within the directory, not outside it.