Do not unnecessarily move 'struct stat st;'.

This commit is contained in:
Erich E. Hoover 2014-04-15 14:20:06 -06:00
parent f6d14c47ec
commit b6d34ea7d2

View File

@ -1,14 +1,14 @@
From b83ae7cc77483519ed870ead3a167e83acbf1cff Mon Sep 17 00:00:00 2001
From bf6cb3c547ce790864af7b244f7934d3f5e3780d Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
Date: Thu, 13 Feb 2014 15:45:48 -0700
Date: Tue, 15 Apr 2014 14:19:26 -0600
Subject: server: Unify the retrieval of security attributes for files and
directories.
---
server/change.c | 32 +++++---------------------------
server/file.c | 34 ++++++++++++++++++++++------------
server/file.c | 32 +++++++++++++++++++++-----------
server/file.h | 2 ++
3 files changed, 29 insertions(+), 39 deletions(-)
3 files changed, 28 insertions(+), 38 deletions(-)
diff --git a/server/change.c b/server/change.c
index 76fc9f7..eb16923 100644
@ -60,7 +60,7 @@ index 76fc9f7..eb16923 100644
}
diff --git a/server/file.c b/server/file.c
index 13ebaf9..8baa712 100644
index 13ebaf9..c98f045 100644
--- a/server/file.c
+++ b/server/file.c
@@ -424,23 +424,19 @@ struct security_descriptor *mode_to_sd( mode_t mode, const SID *user, const SID
@ -72,16 +72,15 @@ index 13ebaf9..8baa712 100644
+ uid_t *uid )
{
- struct file *file = (struct file *)obj;
- struct stat st;
- int unix_fd;
+ int unix_fd = get_unix_fd( fd );
struct stat st;
- int unix_fd;
struct security_descriptor *sd;
-
- assert( obj->ops == &file_ops );
-
- unix_fd = get_file_unix_fd( file );
+ struct stat st;
-
if (unix_fd == -1 || fstat( unix_fd, &st ) == -1)
return obj->sd;