From f23a034a64a7c0b0b07843a46cc2a531c49b4534 Mon Sep 17 00:00:00 2001 From: Philippe Proulx Date: Fri, 2 Jun 2017 13:48:13 -0400 Subject: [PATCH] Use abort() instead of a false assertion MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Philippe Proulx Signed-off-by: Jérémie Galarneau --- compat/compat_mman.c | 20 ++++++++++---------- include/babeltrace/compat/fcntl-internal.h | 4 ++-- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/compat/compat_mman.c b/compat/compat_mman.c index 813fac47..8b874cef 100644 --- a/compat/compat_mman.c +++ b/compat/compat_mman.c @@ -58,7 +58,7 @@ static void mmap_lock(void) { if (pthread_mutex_lock(&mmap_mutex)) { - assert(0); + abort(); } } @@ -66,7 +66,7 @@ static void mmap_unlock(void) { if (pthread_mutex_unlock(&mmap_mutex)) { - assert(0); + abort(); } } @@ -151,7 +151,7 @@ void *mmap(void *start, size_t length, int prot, int flags, int fd, flProtect, 0, offset + length, NULL); if (mapping.map_handle == 0) { if (!CloseHandle(mapping.file_handle)) { - assert(0); + abort(); } _set_errno(EACCES); return MAP_FAILED; @@ -163,10 +163,10 @@ void *mmap(void *start, size_t length, int prot, int flags, int fd, if (mapping.start == 0) { DWORD dwLastErr = GetLastError(); if (!CloseHandle(mapping.map_handle)) { - assert(0); + abort(); } if (!CloseHandle(mapping.file_handle)) { - assert(0); + abort(); } if (dwLastErr == ERROR_MAPPED_ALIGNMENT) { @@ -218,10 +218,10 @@ error_mutex_unlock: mmap_unlock(); if (!CloseHandle(mapping.map_handle)) { - assert(0); + abort(); } if (!CloseHandle(mapping.file_handle)) { - assert(0); + abort(); } _set_errno(ENOMEM); @@ -246,13 +246,13 @@ int munmap(void *start, size_t length) /* Cleanup of handles should never fail */ if (!UnmapViewOfFile(mmap_infos[i].start)) { - assert(0); + abort(); } if (!CloseHandle(mmap_infos[i].map_handle)) { - assert(0); + abort(); } if (!CloseHandle(mmap_infos[i].file_handle)) { - assert(0); + abort(); } mmap_lock(); diff --git a/include/babeltrace/compat/fcntl-internal.h b/include/babeltrace/compat/fcntl-internal.h index 33c2a09f..2040bec0 100644 --- a/include/babeltrace/compat/fcntl-internal.h +++ b/include/babeltrace/compat/fcntl-internal.h @@ -39,7 +39,7 @@ int bt_posix_fallocate(int fd, off_t offset, off_t len) #elif defined(__MINGW32__) /* #ifdef BABELTRACE_HAVE_POSIX_FALLOCATE */ -#include +#include #include #include @@ -124,7 +124,7 @@ restore: /* Restore the original file pointer position */ if (!SetFilePointerEx(handle, file_pos, NULL, FILE_BEGIN)) { /* We moved the file pointer but failed to restore it. */ - assert(0); + abort(); } end: -- 2.34.1