From ea4eafb60d0ab7d2b923d0418989b2d20c54465b Mon Sep 17 00:00:00 2001 From: Andrea Mazzoleni Date: Fri, 11 Jul 2014 23:33:19 +0200 Subject: [PATCH] Fixes the Windows regression test. --- cmdline/mktest.c | 4 ++-- cmdline/scan.c | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/cmdline/mktest.c b/cmdline/mktest.c index 9454fe60..30406143 100644 --- a/cmdline/mktest.c +++ b/cmdline/mktest.c @@ -125,7 +125,7 @@ unsigned char* file_read(const char* path, int size, int extra_alloc) data = malloc(size + extra_alloc); - f = open(path, O_RDONLY); + f = open(path, O_RDONLY | O_BINARY); if (f < 0) { /* LCOV_EXCL_START */ fprintf(stderr, "Error opening file %s\n", path); @@ -154,7 +154,7 @@ void file_write(const char* path, const unsigned char* data, int size, struct st { int f; - f = creat(path, S_IRUSR | S_IWUSR); + f = open(path, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY | O_NOFOLLOW, 0600); if (f < 0) { /* LCOV_EXCL_START */ fprintf(stderr, "Error creating file %s\n", path); diff --git a/cmdline/scan.c b/cmdline/scan.c index 9773541e..7e6a3076 100644 --- a/cmdline/scan.c +++ b/cmdline/scan.c @@ -1031,13 +1031,14 @@ static int scan_dir(struct snapraid_scan* scan, int output, const char* dir, con /* LCOV_EXCL_STOP */ } -#if HAVE_STRUCT_DIRENT_D_INO if (state->opt.force_order == SORT_ALPHA) { /* if requested sort alphabetically */ /* this is mainly done for testing to ensure to always */ /* process in the same way in different platforms */ tommy_list_sort(&list, dd_name_compare); - } else if (!disk->has_volatile_inodes) { + } +#if HAVE_STRUCT_DIRENT_D_INO + else if (!disk->has_volatile_inodes) { /* if inodes are persistent */ /* sort the list of dir entries by inodes */ tommy_list_sort(&list, dd_ino_compare);