From 62eda39fc19589140bca432042b888ed4ffb149e Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Mon, 23 Nov 2009 16:20:15 +0100 Subject: [PATCH] server: Moved the create_temp_file function to mapping.c. --- server/file.c | 19 +------------------ server/file.h | 2 +- server/mapping.c | 17 +++++++++++++++++ 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/server/file.c b/server/file.c index 01fefdbe54..c09ddc5ca9 100644 --- a/server/file.c +++ b/server/file.c @@ -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; diff --git a/server/file.h b/server/file.h index 27aed39b1c..1ace6f75bf 100644 --- a/server/file.h +++ b/server/file.h @@ -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 ); diff --git a/server/mapping.c b/server/mapping.c index e3f69a8cac..b6211bf72a 100644 --- a/server/mapping.c +++ b/server/mapping.c @@ -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 ) { -- 2.32.0.93.g670b81a890