1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-12 14:29:28 +00:00

Simplify string duplication: 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:56 +00:00
parent dae7204032
commit fa65b91ab3
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=243898

View File

@ -50,12 +50,11 @@ setgrdir(const char * dir)
{
if (dir == NULL)
return -1;
else {
char * d = malloc(strlen(dir)+1);
if (d == NULL)
return -1;
grpath = strcpy(d, dir);
}
else
grpath = strdup(dir);
if (grpath == NULL)
return -1;
return 0;
}