The if clause change is pretty trivial. Moving the macro near to where it is used makes sense to people who want to read the code. And finally the comment about user list was at wrong spot. Signed-off-by: Sami Kerola <kerolasa@xxxxxx> --- login-utils/lslogins.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/login-utils/lslogins.c b/login-utils/lslogins.c index 3ff7725..60a1b50 100644 --- a/login-utils/lslogins.c +++ b/login-utils/lslogins.c @@ -766,14 +766,6 @@ static struct lslogins_user *get_user_info(struct lslogins_control *ctl, const c return user; } -/* some UNIX implementations set errno iff a passwd/grp/... - * entry was not found. The original UNIX logins(1) utility always - * ignores invalid login/group names, so we're going to as well.*/ -#define IS_REAL_ERRNO(e) !((e) == ENOENT || (e) == ESRCH || \ - (e) == EBADF || (e) == EPERM || (e) == EAGAIN) - -/* get a definitive list of users we want info about... */ - static int str_to_uint(char *s, unsigned int *ul) { char *end; @@ -785,6 +777,7 @@ static int str_to_uint(char *s, unsigned int *ul) return 1; } +/* get a definitive list of users we want info about... */ static int get_ulist(struct lslogins_control *ctl, char *logins, char *groups) { char *u, *g; @@ -878,13 +871,18 @@ static struct lslogins_user *get_next_user(struct lslogins_control *ctl) return u; } +/* some UNIX implementations set errno iff a passwd/grp/... + * entry was not found. The original UNIX logins(1) utility always + * ignores invalid login/group names, so we're going to as well.*/ +#define IS_REAL_ERRNO(e) !((e) == ENOENT || (e) == ESRCH || \ + (e) == EBADF || (e) == EPERM || (e) == EAGAIN) + static int get_user(struct lslogins_control *ctl, struct lslogins_user **user, const char *username) { *user = get_user_info(ctl, username); - if (!*user) - if (IS_REAL_ERRNO(errno)) - return -1; + if (!*user && IS_REAL_ERRNO(errno)) + return -1; return 0; } -- 2.9.0 -- To unsubscribe from this list: send the line "unsubscribe util-linux" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html