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;
}
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "[email protected]"