Skip to content

Commit 60bdce0

Browse files
committed
Fix FD leak when checking lock dir permissions.
`mkstemp(3)` creates and opens a file descriptor for a temporary file, but this file descriptor was immediately discarded in favour of `fopen(3)`'ing the file by name and using that `FILE *` stream. I'm sure whoever originally wrote this code meant to use `mktemp(3)` instead, which only creates a unique file from a template name (equivalent to `mktemp(1)`).
1 parent 6c54eeb commit 60bdce0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/main/c/src/SerialImp.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -5835,7 +5835,7 @@ int check_group_uucp()
58355835
strcat(testLockAbsFileName, testLockFileDirName);
58365836
strcat(testLockAbsFileName, "/");
58375837
strcat(testLockAbsFileName, testLockFileName);
5838-
if ( 0 == mkstemp(testLockAbsFileName) )
5838+
if ( NULL == mktemp(testLockAbsFileName) )
58395839
{
58405840
free(testLockAbsFileName);
58415841
report_error("check_group_uucp(): mktemp malformed string - \

0 commit comments

Comments
 (0)