svn commit: r243896 - head/usr.sbin/pw
Eitan Adler
eadler at FreeBSD.org
Wed Dec 5 13:56:50 UTC 2012
Author: eadler
Date: Wed Dec 5 13:56:49 2012
New Revision: 243896
URL: http://svnweb.freebsd.org/changeset/base/243896
Log:
Use strdup instead of malloc + strcpy
Submitted by: db
Approved by: cperciva
MFC after: 2 weeks
Modified:
head/usr.sbin/pw/pwupd.c
Modified: head/usr.sbin/pw/pwupd.c
==============================================================================
--- head/usr.sbin/pw/pwupd.c Wed Dec 5 13:56:46 2012 (r243895)
+++ head/usr.sbin/pw/pwupd.c Wed Dec 5 13:56:49 2012 (r243896)
@@ -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;
}
More information about the svn-src-head
mailing list