Skip to content

LOG_SYS_FATAL

LOG_SYS_FATAL

Description

Writes a fatal log message and aborts the program, with errno explanation appended at the end of final string.

Think of this as perror() with LOG

Success

Message logged and program aborted via abort()

Failure

Logging may fail silently, but abort() will still execute

Usage example (Cross-references)

Usage examples (Cross-references)
        char *new_str = (char *)malloc(len + 1);
        if (!new_str) {
            LOG_SYS_FATAL("malloc() failed");
        }
    
            if (!buffer) {
                LOG_SYS_FATAL("malloc() failed");
            }
            char *ptr = realloc(vec->data, (n + 1) * vec_aligned_size(vec, item_size));
            if (!ptr) {
                LOG_SYS_FATAL("realloc() failed");
            }
            // it's mandatory to set the pointer here, because next call to any vec_ will do a validation check
            ptr = realloc(vec->data, (vec->length + 1) * vec_aligned_size(vec, item_size));
            if (!ptr) {
                LOG_SYS_FATAL("realloc() failed");
            }
            vec->capacity = vec->length;
            map->states   = old_states;
            map->capacity = old_capacity;
            LOG_SYS_FATAL("calloc() failed");
        }
        int status;
        if (-1 == waitpid(proc->pid, &status, 0)) {
            LOG_SYS_FATAL("Failed to wait for child process");
        }
    #else
        if (WAIT_FAILED == WaitForSingleObject(proc->pi.hProcess, INFINITE)) {
            LOG_SYS_FATAL("Failed to wait for child process");
        }
Last updated on