add error checking to setfsuid/setfsgid calls

git-svn-id: http://encfs.googlecode.com/svn/trunk@13 db9cf616-1c43-0410-9cb8-a902689de0d6
This commit is contained in:
Valient Gough 2008-04-11 08:36:51 +00:00
parent 931dcdd2af
commit 9ce4a03887

View File

@ -176,9 +176,23 @@ int FileNode::mknod(mode_t mode, dev_t rdev, uid_t uid, gid_t gid)
int olduid = -1;
int oldgid = -1;
if(uid != 0)
{
olduid = setfsuid( uid );
if(olduid == -1)
{
rInfo("setfsuid error: %s", strerror(errno));
return -EPERM;
}
}
if(gid != 0)
{
oldgid = setfsgid( gid );
if(oldgid == -1)
{
rInfo("setfsgid error: %s", strerror(errno));
return -EPERM;
}
}
/*
* cf. xmp_mknod() in fusexmp.c