diff options
author | Samuel Holland <samuel@sholland.org> | 2018-01-14 18:28:35 -0600 |
---|---|---|
committer | Samuel Holland <samuel@sholland.org> | 2018-01-14 18:28:35 -0600 |
commit | d40369b0e09e4e2228ebff305067ec2d99220848 (patch) | |
tree | 0839bc088f3f0b577e0badddab745fa9f3c94dd4 /libgcompat/pwd.c | |
parent | 28748009c0dc553e2fe5e6253e7615cf89d2b7ef (diff) | |
download | gcompat-d40369b0e09e4e2228ebff305067ec2d99220848.tar.gz gcompat-d40369b0e09e4e2228ebff305067ec2d99220848.tar.bz2 gcompat-d40369b0e09e4e2228ebff305067ec2d99220848.tar.xz gcompat-d40369b0e09e4e2228ebff305067ec2d99220848.zip |
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 <samuel@sholland.org>
Diffstat (limited to 'libgcompat/pwd.c')
-rw-r--r-- | libgcompat/pwd.c | 30 |
1 files changed, 19 insertions, 11 deletions
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 <stdio.h> #include <errno.h> #include <pwd.h> +#include <stdio.h> #include <string.h> - -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; |