"Michael C. Thornburgh" <zenomt(at)armory(dot)com> writes:
> + len = strlen(pw->pw_name);
> + pw_name_persist = (char *) malloc(len+1);
> + if (pw_name_persist == (char *)NULL)
> + {
> + fprintf(stderr, "%s: can't malloc for username\n", argv[0]);
> + exit(1);
> + }
> + strncpy(pw_name_persist, pw->pw_name, len+1);
This could be simplified to
pw_name_persist = strdup(pw->pw_name);
no?
regards, tom lane