#include #include #include #include #include int main(void) { Tcl_Interp *interp = Tcl_CreateInterp(); struct passwd *pwent = getpwnam("nobody"); Tcl_Obj *pathobj = Tcl_NewStringObj("/", -1); Tcl_IncrRefCount(pathobj); Tcl_Obj *cwdobj = Tcl_FSGetCwd(interp); setegid(pwent->pw_gid); seteuid(pwent->pw_uid); cwdobj = Tcl_FSGetCwd(interp); Tcl_FSChdir(pathobj); return 0; }