From 0cffb46050e5b7ca2a8a54835c76e2bab2a02321 Mon Sep 17 00:00:00 2001 From: Andrea Mazzoleni Date: Tue, 18 Jun 2013 21:13:36 +0200 Subject: [PATCH] Fixes some error conditions reported by clang. --- handle.c | 4 ++-- parity.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/handle.c b/handle.c index 16e82178..2a8b8391 100644 --- a/handle.c +++ b/handle.c @@ -200,12 +200,12 @@ int handle_close(struct snapraid_handle* handle) if (handle->f != -1) { ret = close(handle->f); if (ret != 0) { + fprintf(stderr, "Error closing file '%s'. %s.\n", handle->file->sub, strerror(errno)); + /* invalidate for error */ handle->file = 0; handle->f = -1; handle->valid_size = 0; - - fprintf(stderr, "Error closing file '%s'. %s.\n", handle->file->sub, strerror(errno)); return -1; } } diff --git a/parity.c b/parity.c index 7c234159..d0df73ab 100644 --- a/parity.c +++ b/parity.c @@ -149,11 +149,11 @@ int parity_chsize(struct snapraid_parity* parity, data_off_t size, data_off_t* o const char* call; #if HAVE_FALLOCATE + call = "fallocate"; if (!skip_fallocate) { /* allocate real space using the specific Linux fallocate() operation. */ /* If the underline filesystem doesn't support it, this operation fails, */ /* instead posix_fallocate() fallbacks to write the whole file. */ - call = "fallocate"; ret = fallocate(parity->f, 0, 0, size); /* fallocate() returns the error number as positive integer, */