From d40369b0e09e4e2228ebff305067ec2d99220848 Mon Sep 17 00:00:00 2001 From: Samuel Holland Date: Sun, 14 Jan 2018 18:28:35 -0600 Subject: global: Format the code consistently * Apply clang-format. * Change all comments to the same style. * Add braces as dictated by the coding style guidelines. Signed-off-by: Samuel Holland --- libgcompat/pwd.c | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) (limited to 'libgcompat/pwd.c') diff --git a/libgcompat/pwd.c b/libgcompat/pwd.c index 2e09aea..50d8da0 100644 --- a/libgcompat/pwd.c +++ b/libgcompat/pwd.c @@ -1,23 +1,27 @@ /* some musl versions incorrectly mark fgetpwent() as a GNU extension */ #define _GNU_SOURCE -#include #include #include +#include #include - -int getpwent_r(struct passwd *pwbuf, char *buf, size_t buflen, struct passwd **pwbufp) { +int getpwent_r(struct passwd *pwbuf, char *buf, size_t buflen, + struct passwd **pwbufp) +{ struct passwd *pwd; - if (pwbufp == NULL || pwbuf == NULL) + if (pwbufp == NULL || pwbuf == NULL) { return ERANGE; + } - if (buflen < 1) + if (buflen < 1) { return ERANGE; + } - if (buf != NULL) + if (buf != NULL) { *buf = '\0'; + } if ((pwd = getpwent()) == NULL) { *pwbufp = NULL; @@ -30,18 +34,22 @@ int getpwent_r(struct passwd *pwbuf, char *buf, size_t buflen, struct passwd **p return 0; } - -int fgetpwent_r(FILE *filp, struct passwd *pwbuf, char *buf, size_t buflen, struct passwd **pwbufp) { +int fgetpwent_r(FILE *filp, struct passwd *pwbuf, char *buf, size_t buflen, + struct passwd **pwbufp) +{ struct passwd *pwd; - if (pwbufp == NULL || pwbuf == NULL) + if (pwbufp == NULL || pwbuf == NULL) { return ERANGE; + } - if (buflen < 1) + if (buflen < 1) { return ERANGE; + } - if (buf != NULL) + if (buf != NULL) { *buf = '\0'; + } if ((pwd = fgetpwent(filp)) == NULL) { *pwbufp = NULL; -- cgit v1.2.3-60-g2f50