Skip to content

Commit

Permalink
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
11 changes: 8 additions & 3 deletions include/os/rt_linux.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@

#ifdef KTHREAD_SUPPORT
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,4)
#error "This kerne version doesn't support kthread!!"
#error "This kernel version doesn't support kthread!!"
#endif
#endif /* KTHREAD_SUPPORT */

Expand Down Expand Up @@ -277,8 +277,13 @@ typedef struct file* RTMP_OS_FD;

typedef struct _OS_FS_INFO_
{
int fsuid;
int fsgid;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)
uid_t fsuid;
gid_t fsgid;
#else
kuid_t fsuid;
kgid_t fsgid;
#endif
mm_segment_t fs;
} OS_FS_INFO;

Expand Down
8 changes: 6 additions & 2 deletions os/linux/rt_linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -1103,9 +1103,13 @@ static inline void __RtmpOSFSInfoChange(OS_FS_INFO * pOSFSInfo, BOOLEAN bSet)
pOSFSInfo->fsuid = current->fsuid.val;
pOSFSInfo->fsgid = current->fsgid.val;
current->fsuid = current->fsgid.val = 0;
#elif LINUX_VERSION_CODE < KERNEL_VERSION(3,12,0)
pOSFSInfo->fsuid = current_fsuid();
pOSFSInfo->fsgid = current_fsgid();
#else
pOSFSInfo->fsuid = current_fsuid().val;
pOSFSInfo->fsgid = current_fsgid().val;
struct user_namespace *to = current_user_ns();
pOSFSInfo->fsuid = from_kuid_munged(to, current_fsuid());
pOSFSInfo->fsgid = from_kgid_munged(to, current_fsgid());
#endif
pOSFSInfo->fs = get_fs();
set_fs(KERNEL_DS);
Expand Down

0 comments on commit a1e9610

Please sign in to comment.