[BACK]Return to common.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / rdist

Diff for /src/usr.bin/rdist/common.c between version 1.29 and 1.30

version 1.29, 2014/07/05 06:55:29 version 1.30, 2014/07/05 07:22:18
Line 616 
Line 616 
         return(pw_dir);          return(pw_dir);
 }  }
   
 #if     defined(DIRECT_RCMD)  
 /*  
  * Set our effective user id to the user running us.  
  * This should be the uid we do most of our work as.  
  */  
 int  
 becomeuser(void)  
 {  
         int r = 0;  
   
 #if     defined(HAVE_SAVED_IDS)  
         r = seteuid(userid);  
 #else  
         r = setreuid(0, userid);  
 #endif  /* HAVE_SAVED_IDS */  
   
         if (r < 0)  
                 error("becomeuser %u failed: %s (ruid = %u euid = %u)",  
                       userid, SYSERR, getuid(), geteuid());  
   
         return(r);  
 }  
 #endif  /* DIRECT_RCMD */  
   
 #if     defined(DIRECT_RCMD)  
 /*  
  * Set our effective user id to "root" (uid = 0)  
  */  
 int  
 becomeroot(void)  
 {  
         int r = 0;  
   
 #if     defined(HAVE_SAVED_IDS)  
         r = seteuid(0);  
 #else  
         r = setreuid(userid, 0);  
 #endif  /* HAVE_SAVED_IDS */  
   
         if (r < 0)  
                 error("becomeroot failed: %s (ruid = %u euid = %u)",  
                       SYSERR, getuid(), geteuid());  
   
         return(r);  
 }  
 #endif  /* DIRECT_RCMD */  
   
 /*  /*
  * Set access and modify times of a given file   * Set access and modify times of a given file

Legend:
Removed from v.1.29  
changed lines
  Added in v.1.30