mirror of
https://github.com/TREX-CoE/trexio.git
synced 2025-01-03 10:06:01 +01:00
Check return value of mkdtemp
This commit is contained in:
parent
5cf12131f1
commit
1812deb9dd
@ -180,7 +180,7 @@ trexio_text_init (trexio_t* const file)
|
|||||||
Create a dummy temporary file for dummy locking.
|
Create a dummy temporary file for dummy locking.
|
||||||
*/
|
*/
|
||||||
char dirname[TREXIO_MAX_FILENAME_LENGTH] = "/tmp/trexio.XXXXXX";
|
char dirname[TREXIO_MAX_FILENAME_LENGTH] = "/tmp/trexio.XXXXXX";
|
||||||
mkdtemp(dirname);
|
if (mkdtemp(dirname) == NULL) return TREXIO_ERRNO;
|
||||||
strncpy (file_name, dirname, TREXIO_MAX_FILENAME_LENGTH);
|
strncpy (file_name, dirname, TREXIO_MAX_FILENAME_LENGTH);
|
||||||
strncat (file_name, lock_file_name, TREXIO_MAX_FILENAME_LENGTH-strlen(lock_file_name));
|
strncat (file_name, lock_file_name, TREXIO_MAX_FILENAME_LENGTH-strlen(lock_file_name));
|
||||||
f->lock_file = open(file_name,O_WRONLY|O_CREAT|O_TRUNC, 0644);
|
f->lock_file = open(file_name,O_WRONLY|O_CREAT|O_TRUNC, 0644);
|
||||||
|
Loading…
Reference in New Issue
Block a user