svn commit: r246280 - stable/9/usr.sbin/pw
Eitan Adler
eadler at FreeBSD.org
Sun Feb 3 03:44:00 UTC 2013
Author: eadler
Date: Sun Feb 3 03:43:59 2013
New Revision: 246280
URL: http://svnweb.freebsd.org/changeset/base/246280
Log:
MFC r243896:
Use strdup instead of malloc + strcpy
Approved by: cperciva (mentor, implicit)
Modified:
stable/9/usr.sbin/pw/pwupd.c
Directory Properties:
stable/9/usr.sbin/pw/ (props changed)
Modified: stable/9/usr.sbin/pw/pwupd.c
==============================================================================
--- stable/9/usr.sbin/pw/pwupd.c Sun Feb 3 03:38:44 2013 (r246279)
+++ stable/9/usr.sbin/pw/pwupd.c Sun Feb 3 03:43:59 2013 (r246280)
@@ -53,12 +53,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-stable-9
mailing list