/
githubmirror
/
libblkio
Обзор
Документация
Войти
/
githubmirror
/
libblkio
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
tests/error-msg.c
39 строк
674 B
Stefan Hajnoczi
LICENSE: relicense to MIT OR APACHE-2.0
31 авг 2022, 18:43
31 авг 2022, 18:43
501476a
Код
Авторство
О чём код?
// SPDX-License-Identifier: (MIT OR Apache-2.0) #include <stdbool.h> #include <pthread.h> #include "util.h" static bool has_error_msg(void) { return blkio_get_error_msg()[0] != '\0'; } static void *thread_fn(void *arg) { struct blkio *b; assert(!has_error_msg()); err(blkio_create("foo", &b), -ENOENT); assert(!b); assert(has_error_msg()); return NULL; } /* * Verify that error messages are thread-local. */ int main(void) { pthread_t thread; assert(!has_error_msg()); assert(pthread_create(&thread, NULL, thread_fn, NULL) == 0); assert(pthread_join(thread, NULL) == 0); assert(!has_error_msg()); return 0; }