Use strdup instead of malloc + strcpy

Submitted by:	db
Approved by:	cperciva
MFC after:	2 weeks
This commit is contained in:
Eitan Adler 2012-12-05 13:56:49 +00:00
parent 6c3c59886c
commit 91d073903e
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=243896

View File

@ -56,12 +56,10 @@ setpwdir(const char * dir)
{
if (dir == NULL)
return -1;
else {
char * d = malloc(strlen(dir)+1);
if (d == NULL)
return -1;
pwpath = strcpy(d, dir);
}
else
pwpath = strdup(dir);
if (pwpath == NULL)
return -1;
return 0;
}