Fixes some error conditions reported by clang.

This commit is contained in:
Andrea Mazzoleni 2013-06-18 21:13:36 +02:00
parent fceaa8a4cf
commit 0cffb46050
2 changed files with 3 additions and 3 deletions

View file

@ -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;
}
}

View file

@ -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, */