int getpwuid_r(uid_t uid, struct passwd *pwd, char *buf, size_t buflen, struct passwd **result) { *result = NULL; if( uid == 0 ) { int ret = fill_pwd(&gPwd_RootInfo, pwd, buf, buflen); if(ret) return ret; *result = pwd; } return 0; }
int getpwnam_r(const char *name, struct passwd *pwd, char *buf, size_t buflen, struct passwd **result) { *result = NULL; if( strcmp(name, "root") == 0 ) { int ret = fill_pwd(&gPwd_RootInfo, pwd, buf, buflen); if(ret) return ret; *result = pwd; } return 0; }
int modif(char **env, t_param_env *param) { int taille; int lim; if (param->y_pwd == 0) return (0); taille = my_strlen(env[param->y_pwd]); env[param->y_old_pwd] = cpy_str2("OLD", env[param->y_pwd]); while (taille >= 0) { if (env[param->y_pwd][taille] == '/') { lim = taille; break; } taille--; } fill_pwd(env, param, lim); return (0); }