summaryrefslogtreecommitdiff
path: root/lib/commonio.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/commonio.c')
-rw-r--r--lib/commonio.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/commonio.c b/lib/commonio.c
index cc536bf1..2e2f7785 100644
--- a/lib/commonio.c
+++ b/lib/commonio.c
@@ -968,11 +968,10 @@ int commonio_close (struct commonio_db *db)
} else {
/*
* Default permissions for new [g]shadow files.
- * (passwd and group always exist...)
*/
- sb.st_mode = 0400;
- sb.st_uid = 0;
- sb.st_gid = 0;
+ sb.st_mode = db->st_mode;
+ sb.st_uid = db->st_uid;
+ sb.st_gid = db->st_gid;
}
snprintf (buf, sizeof buf, "%s+", db->filename);
@@ -1081,6 +1080,7 @@ int commonio_update (struct commonio_db *db, const void *eptr)
if (NULL != p) {
if (next_entry_by_name (db, p->next, db->ops->getname (eptr)) != NULL) {
fprintf (stderr, _("Multiple entries named '%s' in %s. Please fix this with pwck or grpck.\n"), db->ops->getname (eptr), db->filename);
+ db->ops->free (nentry);
return 0;
}
db->ops->free (p->eptr);