diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2016-03-20 00:01:23 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2016-03-20 00:01:23 +0000 |
commit | 276cbad1f829d62d4f85498a058f5ea0cc61557f (patch) | |
tree | 5e320a1dd34c0104d488b776f4540ea2bad79709 /regress | |
parent | a03665481d25c081209ea32e59ed23a80f839be2 (diff) |
Currently we have about a 50/50 split over fcntl(n, F_GETFL [,0])
idioms.
Adopt the more concise fcntl(n, F_GETFL) over fcntl(n, F_GETFL, 0)
where it is obvious further investigation will not yield and
even better way.
Obviousness evaluation and ok guenther@
Diffstat (limited to 'regress')
-rw-r--r-- | regress/lib/libpthread/stdfiles/stdfiles.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/regress/lib/libpthread/stdfiles/stdfiles.c b/regress/lib/libpthread/stdfiles/stdfiles.c index 7d91109c5a6..69f75dcf1c2 100644 --- a/regress/lib/libpthread/stdfiles/stdfiles.c +++ b/regress/lib/libpthread/stdfiles/stdfiles.c @@ -1,4 +1,4 @@ -/* $OpenBSD: stdfiles.c,v 1.2 2003/11/27 22:51:36 marc Exp $ */ +/* $OpenBSD: stdfiles.c,v 1.3 2016/03/20 00:01:22 krw Exp $ */ /* $snafu: stdfiles.c,v 1.3 2003/02/03 21:22:26 marc Exp $ */ /* PUBLIC DOMAIN Oct 2002 Marco S Hyman <marc@snafu.org> */ @@ -28,13 +28,13 @@ main(int argc, char *argv[]) dup_stdout = dup(STDOUT_FILENO); /* read std in/out/err flags */ - stdin_flags = fcntl(STDIN_FILENO, F_GETFL, 0); + stdin_flags = fcntl(STDIN_FILENO, F_GETFL); assert(stdin_flags != -1); - stdout_flags = fcntl(STDOUT_FILENO, F_GETFL, 0); + stdout_flags = fcntl(STDOUT_FILENO, F_GETFL); assert(stdout_flags != -1); - dup_flags = fcntl(dup_stdout, F_GETFL, 0); + dup_flags = fcntl(dup_stdout, F_GETFL); assert(dup_flags != -1); - stderr_flags = fcntl(STDERR_FILENO, F_GETFL, 0); + stderr_flags = fcntl(STDERR_FILENO, F_GETFL); assert(stderr_flags != -1); printf("starting flags: in = %x, out = %x, dup = %x, err = %x\n", stdin_flags, stdout_flags, dup_flags, stderr_flags); @@ -44,7 +44,7 @@ main(int argc, char *argv[]) printf("forcing stdin to O_NONBLOCK (flags %x)\n", new_flags); assert(fcntl(STDIN_FILENO, F_SETFL, new_flags) != -1); - new_flags = fcntl(STDIN_FILENO, F_GETFL, 0); + new_flags = fcntl(STDIN_FILENO, F_GETFL); assert(new_flags != -1); if (new_flags != stdin_flags) { printf("stdin flags changed %x -> %x\n", stdin_flags, @@ -52,7 +52,7 @@ main(int argc, char *argv[]) stdin_flags = new_flags; } - new_flags = fcntl(STDOUT_FILENO, F_GETFL, 0); + new_flags = fcntl(STDOUT_FILENO, F_GETFL); assert(new_flags != -1); if (new_flags != stdout_flags) { printf("stdout flags changed %x -> %x\n", stdout_flags, @@ -60,7 +60,7 @@ main(int argc, char *argv[]) stdout_flags = new_flags; } - new_flags = fcntl(dup_stdout, F_GETFL, 0); + new_flags = fcntl(dup_stdout, F_GETFL); assert(new_flags != -1); if (new_flags != dup_flags) { printf("dup_stdout flags changed %x -> %x\n", dup_flags, @@ -68,7 +68,7 @@ main(int argc, char *argv[]) dup_flags = new_flags; } - new_flags = fcntl(STDERR_FILENO, F_GETFL, 0); + new_flags = fcntl(STDERR_FILENO, F_GETFL); assert(new_flags != -1); if (new_flags != stderr_flags) { printf("stderr flags changed %x -> %x\n", stderr_flags, @@ -84,7 +84,7 @@ main(int argc, char *argv[]) assert(close(STDERR_FILENO) != -1); new_fd = open("/dev/tty", O_RDWR|O_CREAT, 0666); assert(new_fd == STDERR_FILENO); - new_flags = fcntl(STDERR_FILENO, F_GETFL, 0); + new_flags = fcntl(STDERR_FILENO, F_GETFL); assert(new_flags != -1); printf("/dev/tty [STDERR_FILENO] flags are %x\n", new_flags); stderr_flags = new_flags | O_NONBLOCK; @@ -96,11 +96,11 @@ main(int argc, char *argv[]) printf("turning off O_NONBLOCK on stdin (flags %x)\n", stdin_flags); assert(fcntl(STDIN_FILENO, F_SETFL, stdin_flags) != -1); - new_flags = fcntl(STDIN_FILENO, F_GETFL, 0); + new_flags = fcntl(STDIN_FILENO, F_GETFL); assert(new_flags != -1); assert(new_flags == stdin_flags); - new_flags = fcntl(STDOUT_FILENO, F_GETFL, 0); + new_flags = fcntl(STDOUT_FILENO, F_GETFL); assert(new_flags != -1); if (new_flags != stdout_flags) { printf("stdout flags changed %x -> %x\n", stdout_flags, @@ -108,7 +108,7 @@ main(int argc, char *argv[]) stdout_flags = new_flags; } - new_flags = fcntl(dup_stdout, F_GETFL, 0); + new_flags = fcntl(dup_stdout, F_GETFL); assert(new_flags != -1); if (new_flags != dup_flags) { printf("dup_stdout flags changed %x -> %x\n", dup_flags, @@ -116,7 +116,7 @@ main(int argc, char *argv[]) dup_flags = new_flags; } - new_flags = fcntl(STDERR_FILENO, F_GETFL, 0); + new_flags = fcntl(STDERR_FILENO, F_GETFL); assert(new_flags != -1); if (new_flags != stderr_flags) { printf("stderr flags changed %x -> %x\n", stderr_flags, |