diff options
author | jedgar <jedgar@FreeBSD.org> | 2001-12-03 00:51:36 +0000 |
---|---|---|
committer | jedgar <jedgar@FreeBSD.org> | 2001-12-03 00:51:36 +0000 |
commit | 30f5e7ea6e8102cba1c7db2753e8a7c1dbf8137d (patch) | |
tree | 25f1f21319524081b88d9ebfbfe0bc3c53af3ac5 /bin/setfacl/file.c | |
parent | e0f46659fc7ba2e524035cc4c192580d56ccf416 (diff) | |
download | FreeBSD-src-30f5e7ea6e8102cba1c7db2753e8a7c1dbf8137d.zip FreeBSD-src-30f5e7ea6e8102cba1c7db2753e8a7c1dbf8137d.tar.gz |
style(9) cleanups mostly consisting of:
o explicitly check return values and variables against a value
o return x; -> return (x);
o fix inconsistent sysexits usage by nuking it (partially
suggested by bde)
Obtained from: TrustedBSD Project
Diffstat (limited to 'bin/setfacl/file.c')
-rw-r--r-- | bin/setfacl/file.c | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/bin/setfacl/file.c b/bin/setfacl/file.c index 3e3c805..d2cdb98 100644 --- a/bin/setfacl/file.c +++ b/bin/setfacl/file.c @@ -32,43 +32,44 @@ #include <err.h> #include <stdio.h> #include <string.h> -#include <sysexits.h> #include "setfacl.h" -/* read acl text from a file and return the corresponding acl */ +/* + * read acl text from a file and return the corresponding acl + */ acl_t get_acl_from_file(const char *filename) { FILE *file; char buf[BUFSIZ]; - if (!filename) - err(EX_USAGE, "(null) filename in get_acl_from_file()"); + if (filename == NULL) + err(1, "(null) filename in get_acl_from_file()"); bzero(&buf, sizeof(buf)); - if (!strcmp(filename, "-")) { - if (have_stdin) - err(EX_USAGE, "cannot specify more than one stdin"); + if (strcmp(filename, "-") == 0) { + if (have_stdin != 0) + err(1, "cannot specify more than one stdin"); file = stdin; have_stdin = 1; } else { file = fopen(filename, "r"); - if (!file) - err(EX_OSERR, "fopen() %s failed", filename); + if (file == NULL) + err(1, "fopen() %s failed", filename); } fread(buf, sizeof(buf), (size_t)1, file); - if (ferror(file)) { + if (ferror(file) != 0) { fclose(file); - err(EX_USAGE, "error reading from %s", filename); - } else if (!feof(file)) { + err(1, "error reading from %s", filename); + } else if (feof(file) == 0) { fclose(file); - errx(EX_USAGE, "line too long in %s", filename); + errx(1, "line too long in %s", filename); } fclose(file); - return acl_from_text(buf); + return (acl_from_text(buf)); } |