32 lines
674 B
C
32 lines
674 B
C
|
|
||
|
#include <config.h>
|
||
|
|
||
|
#ident "$Id: pwio.c 1342 2007-11-10 23:46:11Z nekral-guest $"
|
||
|
|
||
|
#include "prototypes.h"
|
||
|
#include "defines.h"
|
||
|
#include <pwd.h>
|
||
|
#include <stdio.h>
|
||
|
#include "pwio.h"
|
||
|
|
||
|
struct passwd *__pw_dup (const struct passwd *pwent)
|
||
|
{
|
||
|
struct passwd *pw;
|
||
|
|
||
|
if (!(pw = (struct passwd *) malloc (sizeof *pw)))
|
||
|
return NULL;
|
||
|
*pw = *pwent;
|
||
|
if (!(pw->pw_name = strdup (pwent->pw_name)))
|
||
|
return NULL;
|
||
|
if (!(pw->pw_passwd = strdup (pwent->pw_passwd)))
|
||
|
return NULL;
|
||
|
if (!(pw->pw_gecos = strdup (pwent->pw_gecos)))
|
||
|
return NULL;
|
||
|
if (!(pw->pw_dir = strdup (pwent->pw_dir)))
|
||
|
return NULL;
|
||
|
if (!(pw->pw_shell = strdup (pwent->pw_shell)))
|
||
|
return NULL;
|
||
|
return pw;
|
||
|
}
|
||
|
|