summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/smbrun.c11
-rw-r--r--source3/lib/system.c22
2 files changed, 20 insertions, 13 deletions
diff --git a/source3/lib/smbrun.c b/source3/lib/smbrun.c
index 89c924260f..0642c30a75 100644
--- a/source3/lib/smbrun.c
+++ b/source3/lib/smbrun.c
@@ -84,12 +84,11 @@ int smbrun(char *cmd,char *outfile,BOOL shared)
pid_t pid;
uid_t uid = current_user.uid;
gid_t gid = current_user.gid;
-
- /*
- * Lose any kernel oplock capabilities we may have.
- */
- set_process_capability(KERNEL_OPLOCK_CAPABILITY, False);
- set_inherited_process_capability(KERNEL_OPLOCK_CAPABILITY, False);
+
+ /*
+ * Lose any kernel oplock capabilities we may have.
+ */
+ oplock_set_capability(False, False);
#ifndef HAVE_EXECL
{
diff --git a/source3/lib/system.c b/source3/lib/system.c
index 80a968b634..3a9cca6a72 100644
--- a/source3/lib/system.c
+++ b/source3/lib/system.c
@@ -438,13 +438,12 @@ struct hostent *sys_gethostbyname(const char *name)
}
+#if defined(HAVE_IRIX_SPECIFIC_CAPABILITIES)
/**************************************************************************
Try and abstract process capabilities (for systems that have them).
****************************************************************************/
-
-BOOL set_process_capability( uint32 cap_flag, BOOL enable )
+static BOOL set_process_capability( uint32 cap_flag, BOOL enable )
{
-#if defined(HAVE_IRIX_SPECIFIC_CAPABILITIES)
if(cap_flag == KERNEL_OPLOCK_CAPABILITY)
{
cap_t cap = cap_get_proc();
@@ -471,7 +470,6 @@ BOOL set_process_capability( uint32 cap_flag, BOOL enable )
DEBUG(10,("set_process_capability: Set KERNEL_OPLOCK_CAPABILITY.\n"));
}
-#endif
return True;
}
@@ -479,9 +477,8 @@ BOOL set_process_capability( uint32 cap_flag, BOOL enable )
Try and abstract inherited process capabilities (for systems that have them).
****************************************************************************/
-BOOL set_inherited_process_capability( uint32 cap_flag, BOOL enable )
+static BOOL set_inherited_process_capability( uint32 cap_flag, BOOL enable )
{
-#if defined(HAVE_IRIX_SPECIFIC_CAPABILITIES)
if(cap_flag == KERNEL_OPLOCK_CAPABILITY)
{
cap_t cap = cap_get_proc();
@@ -508,9 +505,20 @@ BOOL set_inherited_process_capability( uint32 cap_flag, BOOL enable )
DEBUG(10,("set_inherited_process_capability: Set KERNEL_OPLOCK_CAPABILITY.\n"));
}
-#endif
return True;
}
+#endif
+
+/****************************************************************************
+gain the oplock capability from the kernel if possible
+****************************************************************************/
+void oplock_set_capability(BOOL this_process, BOOL inherit)
+{
+#if HAVE_KERNEL_OPLOCKS_IRIX
+ set_process_capability(KERNEL_OPLOCK_CAPABILITY,this_process);
+ set_inherited_process_capability(KERNEL_OPLOCK_CAPABILITY,inherit);
+#endif
+}
/**************************************************************************
Wrapper for random().