autodriver/autodriver.c
static int parse_user(char *name, struct passwd *user_info, char **buf) {
    struct passwd *result;
    long bufsize;
    int s;

    if ((bufsize = sysconf(_SC_GETPW_R_SIZE_MAX)) < 0) {
        ERROR_ERRNO("Unable to get buffer size");
        exit(EXIT_OSERROR);
    }

    if ((*buf = malloc(bufsize)) == NULL) {
        ERROR("Unable to malloc buffer");
        exit(EXIT_OSERROR);
    }

    s = getpwnam_r(name, user_info, *buf, bufsize, &result);
    if (result == NULL) {
        if (s != 0) {
            errno = s;
            ERROR_ERRNO("Unable to get user info");
            exit(EXIT_OSERROR);
        } else {
            return -1;
        }
    }

    return 0;
}
/**
 * @brief Parses a username into a uid and gid
 *
 * uid and gid are not modified no failure
 *
 * @arg name Username
 * @arg user_info Passwd struct to store info in
 * @arg buf Pointer to allocate buffer for user_info to
 *
 * @return 0 on success, -1 on unknown user
 */
@brief Parses a username into a uid and gid
uid and gid are not modified no failure

@arg name Username
@arg user_info Passwd struct to store info in
@arg buf Pointer to allocate buffer for user_info to

@return 0 on success, -1 on unknown user
@brief Parses a username into a uid and gid uid and gid are not modified no failure @arg name Username @arg user_info Passwd struct to store info in @arg buf Pointer to allocate buffer for user_info to @return 0 on success - 1 on unknown user
static int parse_user(char *name, struct passwd *user_info, char **buf) {
    struct passwd *result;
    long bufsize;
    int s;
    if ((bufsize = sysconf(_SC_GETPW_R_SIZE_MAX)) < 0) {
        ERROR_ERRNO("Unable to get buffer size");
        exit(EXIT_OSERROR);
    }
    if ((*buf = malloc(bufsize)) == NULL) {
        ERROR("Unable to malloc buffer");
        exit(EXIT_OSERROR);
    }
    s = getpwnam_r(name, user_info, *buf, bufsize, &result);
    if (result == NULL) {
        if (s != 0) {
            errno = s;
            ERROR_ERRNO("Unable to get user info");
            exit(EXIT_OSERROR);
        } else {
            return -1;
        }
    }
    return 0;
}
static int parse_user ( char * name , struct passwd * user_info , char * * buf ) { struct passwd * result ; long bufsize ; int s ; if ( ( bufsize = sysconf ( _SC_GETPW_R_SIZE_MAX ) ) < 0 ) { ERROR_ERRNO ( " " ) ; exit ( EXIT_OSERROR ) ; } if ( ( * buf = malloc ( bufsize ) ) == NULL ) { ERROR ( " " ) ; exit ( EXIT_OSERROR ) ; } s = getpwnam_r ( name , user_info , * buf , bufsize , & result ) ; if ( result == NULL ) { if ( s != 0 ) { errno = s ; ERROR_ERRNO ( " " ) ; exit ( EXIT_OSERROR ) ; } else { return -1 ; } } return 0 ; }
@brief Parses a username into a uid and gid
 uid and gid are not modified no failure
@brief Parses a username into a uid and gid uid and gid are not modified no failure