summaryrefslogtreecommitdiffstats
path: root/tests/bugs/replicate/bug-1250170-fsync.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/bugs/replicate/bug-1250170-fsync.c')
-rw-r--r--tests/bugs/replicate/bug-1250170-fsync.c78
1 files changed, 39 insertions, 39 deletions
diff --git a/tests/bugs/replicate/bug-1250170-fsync.c b/tests/bugs/replicate/bug-1250170-fsync.c
index 421fb5c5067..21fd96594aa 100644
--- a/tests/bugs/replicate/bug-1250170-fsync.c
+++ b/tests/bugs/replicate/bug-1250170-fsync.c
@@ -7,50 +7,50 @@
#include <unistd.h>
#include <string.h>
-int main (int argc, char **argv)
+int
+main(int argc, char **argv)
{
- char *file = NULL;
- int fd = -1;
- char *buffer = NULL;
- size_t buf_size = 0;
- size_t written = 0;
- int ret = 0;
- off_t offset = 0;
- int i = 0;
- int loop_count = 5;
+ char *file = NULL;
+ int fd = -1;
+ char *buffer = NULL;
+ size_t buf_size = 0;
+ size_t written = 0;
+ int ret = 0;
+ off_t offset = 0;
+ int i = 0;
+ int loop_count = 5;
- if (argc < 2) {
- printf ("Usage:%s <filename>\n", argv[0]);
- return -1;
- }
+ if (argc < 2) {
+ printf("Usage:%s <filename>\n", argv[0]);
+ return -1;
+ }
- file = argv[1];
- buf_size = 1024;
- buffer = malloc(buf_size);
- if (!buffer) {
- perror("malloc");
- return -1;
- }
- memset (buffer, 'R', buf_size);
+ file = argv[1];
+ buf_size = 1024;
+ buffer = malloc(buf_size);
+ if (!buffer) {
+ perror("malloc");
+ return -1;
+ }
+ memset(buffer, 'R', buf_size);
- fd = open(file, O_WRONLY);
- if (fd == -1) {
- perror("open");
- return -1;
- }
+ fd = open(file, O_WRONLY);
+ if (fd == -1) {
+ perror("open");
+ return -1;
+ }
- for (i = 0; i < loop_count; i++) {
- ret = write (fd, buffer, buf_size);
- if (ret == -1) {
- perror("write");
- return ret;
- } else {
- written += ret;
- }
- offset = lseek (fd, 0 , SEEK_SET);
+ for (i = 0; i < loop_count; i++) {
+ ret = write(fd, buffer, buf_size);
+ if (ret == -1) {
+ perror("write");
+ return ret;
+ } else {
+ written += ret;
}
+ offset = lseek(fd, 0, SEEK_SET);
+ }
- free(buffer);
- return 0;
-
+ free(buffer);
+ return 0;
}