From: JINMEI Tatuya Date: Mon, 18 Feb 2013 21:07:24 +0000 (-0800) Subject: [2669] piggyback style/editorial cleanups: const, spacing X-Git-Tag: bind10-1.1.0beta1-release~88^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=24503d327ec68c528cfc19e3228223718f1487c9;p=thirdparty%2Fkea.git [2669] piggyback style/editorial cleanups: const, spacing --- diff --git a/src/lib/util/tests/fd_share_tests.cc b/src/lib/util/tests/fd_share_tests.cc index b4eccb7bce..b8000e1a76 100644 --- a/src/lib/util/tests/fd_share_tests.cc +++ b/src/lib/util/tests/fd_share_tests.cc @@ -36,14 +36,14 @@ TEST(FDShare, transfer) { // Get a pipe and fork int pipes[2]; ASSERT_NE(-1, socketpair(AF_UNIX, SOCK_STREAM, 0, pipes)); - pid_t sender(fork()); + const pid_t sender(fork()); ASSERT_NE(-1, sender); - if(sender) { // We are in parent + if (sender) { // We are in parent // Close the other side of pipe, we want only writible one EXPECT_NE(-1, close(pipes[0])); // Get a process to check data int fd(0); - pid_t checker(check_output(&fd, "data", 4)); + const pid_t checker(check_output(&fd, "data", 4)); ASSERT_NE(-1, checker); // Now, send the file descriptor, close it and close the pipe EXPECT_NE(-1, send_fd(pipes[1], fd)); @@ -54,20 +54,20 @@ TEST(FDShare, transfer) { EXPECT_TRUE(process_ok(checker)); } else { // We are in child. We do not use ASSERT here // Close the write end, we only read - if(close(pipes[1])) { + if (close(pipes[1])) { exit(1); } // Get the file descriptor - int fd(recv_fd(pipes[0])); - if(fd == -1) { + const int fd(recv_fd(pipes[0])); + if (fd == -1) { exit(1); } // This pipe is not needed - if(close(pipes[0])) { + if (close(pipes[0])) { exit(1); } // Send "data" trough the received fd, close it and be done - if(!write_data(fd, "data", 4) || close(fd) == -1) { + if (!write_data(fd, "data", 4) || close(fd) == -1) { exit(1); } exit(0);