Use abort() instead of a false assertion
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Fri, 2 Jun 2017 17:48:13 +0000 (13:48 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 9 Jun 2017 20:58:16 +0000 (16:58 -0400)
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
compat/compat_mman.c
include/babeltrace/compat/fcntl-internal.h

index 813fac4705ca3ff6bb6c779a8f625056064b688f..8b874cef4110e3aab75d414510adccb4b8fa73db 100644 (file)
@@ -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();
index 33c2a09f710f5cd96bfc0be50ed50e84473f0fce..2040bec0e84b5d4fc049ba57e2035960150b8ccc 100644 (file)
@@ -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 <assert.h>
+#include <stdlib.h>
 #include <windows.h>
 #include <fcntl.h>
 
@@ -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:
This page took 0.028137 seconds and 4 git commands to generate.