Ignore:
Timestamp:
Nov 4, 2007, 3:16:40 AM (16 years ago)
Author:
Bruno Cornec
Message:

Update to busybox 1.7.2

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.5/mindi-busybox/libbb/change_identity.c

    r821 r1765  
    2929 */
    3030
    31 #include <stdio.h>
    32 #include <errno.h>
    33 #include <unistd.h>
    34 #include <string.h>
    35 #include <stdlib.h>
    36 #include <syslog.h>
    37 #include <ctype.h>
    38 
    3931#include "libbb.h"
    4032
    4133
    4234/* Become the user and group(s) specified by PW.  */
    43 const char *change_identity_e2str ( const struct passwd *pw )
     35const char *change_identity_e2str(const struct passwd *pw)
    4436{
    45     if ( initgroups ( pw-> pw_name, pw-> pw_gid ) == -1 )
     37    if (initgroups(pw->pw_name, pw->pw_gid) == -1)
    4638        return "cannot set groups";
    47     endgrent ( );
    48 
    49     if ( setgid ( pw-> pw_gid ))
    50         return "cannot set group id";
    51     if ( setuid ( pw->pw_uid ))
    52         return "cannot set user id";
     39    endgrent(); /* ?? */
     40    xsetgid(pw->pw_gid);
     41    xsetuid(pw->pw_uid);
    5342    return NULL;
    5443}
    5544
    56 void change_identity ( const struct passwd *pw )
     45void change_identity(const struct passwd *pw)
    5746{
    5847    const char *err_msg = change_identity_e2str(pw);
    5948
    60     if(err_msg)
    61         bb_perror_msg_and_die ( "%s", err_msg );
     49    if (err_msg)
     50        bb_perror_msg_and_die("%s", err_msg);
    6251}
Note: See TracChangeset for help on using the changeset viewer.