diff options
author | David Herrmann <dh.herrmann@gmail.com> | 2015-09-29 11:10:01 +0200 |
---|---|---|
committer | David Herrmann <dh.herrmann@gmail.com> | 2015-11-16 15:34:41 +0100 |
commit | 157f50577fbee094eb8ca18f3f0af4e82af8558f (patch) | |
tree | e5433ebaf3fa89c972478877d7b808f1a0a53000 /src/login/logind-core.c | |
parent | 6230bf750a4c41ff9a7ec291243fc92b059e896b (diff) |
login: make user_new() and user_free() follow coding-style
Few changes to user_new() and user_free():
- Use _cleanup_(user_freep) in constructor
- return 'int' from user_new()
- make user_free() deal with partially initialized objects
- keep reverse-order in user_free() compared to user_new()
- make user_free() return NULL
- make user_free() accept NULL as no-op
Diffstat (limited to 'src/login/logind-core.c')
-rw-r--r-- | src/login/logind-core.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/login/logind-core.c b/src/login/logind-core.c index b3f30c8dc9..38c426c1aa 100644 --- a/src/login/logind-core.c +++ b/src/login/logind-core.c @@ -98,15 +98,16 @@ int manager_add_session(Manager *m, const char *id, Session **_session) { int manager_add_user(Manager *m, uid_t uid, gid_t gid, const char *name, User **_user) { User *u; + int r; assert(m); assert(name); u = hashmap_get(m->users, UID_TO_PTR(uid)); if (!u) { - u = user_new(m, uid, gid, name); - if (!u) - return -ENOMEM; + r = user_new(&u, m, uid, gid, name); + if (r < 0) + return r; } if (_user) |