diff options
Diffstat (limited to 'winsup/cygwin/sec_helper.cc')
-rw-r--r-- | winsup/cygwin/sec_helper.cc | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/winsup/cygwin/sec_helper.cc b/winsup/cygwin/sec_helper.cc index 0c44c6f7c..b97dcd028 100644 --- a/winsup/cygwin/sec_helper.cc +++ b/winsup/cygwin/sec_helper.cc @@ -375,6 +375,20 @@ out: return ret; } +/* Helper function to set the SE_RESTORE_NAME privilege once. */ +void +enable_restore_privilege () +{ + static int NO_COPY saved_res; + bool issetuid = cygheap->user.issetuid (); + if (!saved_res || issetuid) + { + int res = 2 + set_process_privilege (SE_RESTORE_NAME, true, issetuid); + if (!issetuid) + saved_res = res; + } +} + /* * Function to return a common SECURITY_DESCRIPTOR * that * allows all access. |