mirror of
https://github.com/rfivet/uemacs.git
synced 2025-01-17 13:46:59 -05:00
Fix CID 39919 Insecure temporary file.
This commit is contained in:
parent
4042ebe3d1
commit
e34c15741e
@ -4,6 +4,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#ifdef MINGW32
|
||||
@ -20,11 +21,14 @@ static void die( const char *err) {
|
||||
/* Function copyright: git */
|
||||
void xmkstemp( char *template) {
|
||||
int fd ;
|
||||
mode_t o_mask ;
|
||||
|
||||
o_mask = umask( 0177) ;
|
||||
fd = mkstemp( template) ;
|
||||
if( fd < 0)
|
||||
die( "Unable to create temporary file") ;
|
||||
|
||||
umask( o_mask) ;
|
||||
close( fd) ;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user