Commit 62eda39f authored by Alexandre Julliard's avatar Alexandre Julliard

server: Moved the create_temp_file function to mapping.c.

parent 5f808f03
......@@ -115,7 +115,7 @@ static inline int is_overlapped( const struct file *file )
/* create a file from a file descriptor */
/* if the function fails the fd is closed */
static struct file *create_file_for_fd( int fd, unsigned int access, unsigned int sharing )
struct file *create_file_for_fd( int fd, unsigned int access, unsigned int sharing )
{
struct file *file;
struct stat st;
......@@ -226,23 +226,6 @@ int is_same_file( struct file *file1, struct file *file2 )
return is_same_file_fd( file1->fd, file2->fd );
}
/* create a temp file for anonymous mappings */
struct file *create_temp_file( int access )
{
char tmpfn[16];
int fd;
sprintf( tmpfn, "anonmap.XXXXXX" ); /* create it in the server directory */
fd = mkstemps( tmpfn, 0 );
if (fd == -1)
{
file_set_error();
return NULL;
}
unlink( tmpfn );
return create_file_for_fd( fd, access, 0 );
}
static void file_dump( struct object *obj, int verbose )
{
struct file *file = (struct file *)obj;
......
......@@ -113,8 +113,8 @@ extern struct file *get_file_obj( struct process *process, obj_handle_t handle,
unsigned int access );
extern int get_file_unix_fd( struct file *file );
extern int is_same_file( struct file *file1, struct file *file2 );
extern struct file *create_file_for_fd( int fd, unsigned int access, unsigned int sharing );
extern struct file *grab_file_unless_removable( struct file *file );
extern struct file *create_temp_file( int access );
extern void file_set_error(void);
extern struct security_descriptor *mode_to_sd( mode_t mode, const SID *user, const SID *group );
extern mode_t sd_to_mode( const struct security_descriptor *sd, const SID *owner );
......
......@@ -162,6 +162,23 @@ static int grow_file( int unix_fd, file_pos_t new_size )
return 0;
}
/* create a temp file for anonymous mappings */
static struct file *create_temp_file( unsigned int access )
{
char tmpfn[16];
int fd;
sprintf( tmpfn, "anonmap.XXXXXX" ); /* create it in the server directory */
fd = mkstemps( tmpfn, 0 );
if (fd == -1)
{
file_set_error();
return NULL;
}
unlink( tmpfn );
return create_file_for_fd( fd, access, 0 );
}
/* find the shared PE mapping for a given mapping */
static struct file *get_shared_file( struct mapping *mapping )
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment