Skip to content

Commit

Permalink
[XrdFfs] Log an error when setuid or setgid fail
Browse files Browse the repository at this point in the history
  • Loading branch information
ljanyst committed Sep 2, 2013
1 parent 0e24bc7 commit c7e0bca
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/XrdFfs/XrdFfsXrootdfs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,10 @@ static void* xrootdfs_init(struct fuse_conn_info *conn)
}
}
if (i == len) getpwuid_r(atoi(xrootdfs.daemon_user), &pw, pwbuf, pwbuflen, &pwp);
setgid((gid_t)pw.pw_gid);
setuid((uid_t)pw.pw_uid);
if( setgid((gid_t)pw.pw_gid) != 0 )
syslog( LOG_ERR, "ERROR: Unable to set gid to %d", pw.pw_gid );
if( setuid((uid_t)pw.pw_uid) != 0 )
syslog( LOG_ERR, "ERROR: Unable to set uid to %d", pw.pw_uid );
prctl(PR_SET_DUMPABLE, 1); // enable core dump after setuid/setgid
}
free(pwbuf);
Expand Down

0 comments on commit c7e0bca

Please sign in to comment.