summaryrefslogtreecommitdiffstats
path: root/pw/grupd.c
diff options
context:
space:
mode:
Diffstat (limited to 'pw/grupd.c')
-rw-r--r--pw/grupd.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/pw/grupd.c b/pw/grupd.c
index e9f6b5e..3f78e95 100644
--- a/pw/grupd.c
+++ b/pw/grupd.c
@@ -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;
}