Coverage Report

Created: 2026-04-12 06:58

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/FreeRDP/winpr/libwinpr/utils/atexit.c
Line
Count
Source
1
/**
2
 * WinPR: Windows Portable Runtime
3
 * atexit routines
4
 *
5
 * Copyright 2026 Armin Novak <anovak@thincast.com>
6
 * Copyright 2026 Thincast Technologies GmbH
7
 *
8
 * Licensed under the Apache License, Version 2.0 (the "License");
9
 * you may not use this file except in compliance with the License.
10
 * You may obtain a copy of the License at
11
 *
12
 *     http://www.apache.org/licenses/LICENSE-2.0
13
 *
14
 * Unless required by applicable law or agreed to in writing, software
15
 * distributed under the License is distributed on an "AS IS" BASIS,
16
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
 * See the License for the specific language governing permissions and
18
 * limitations under the License.
19
 */
20
21
#include <stdlib.h>
22
#include <errno.h>
23
24
#include <winpr/debug.h>
25
#include <winpr/atexit.h>
26
#include "../log.h"
27
28
#define TAG WINPR_TAG("atexit")
29
30
static size_t atexit_count = 0;
31
32
BOOL winpr_atexit(void (*fkt)(void))
33
1
{
34
1
  atexit_count++;
35
1
  const int rc = atexit(fkt);
36
1
  if (rc != 0)
37
0
  {
38
0
    char buffer[128] = WINPR_C_ARRAY_INIT;
39
0
    WLog_ERR(TAG, "atexit[%" PRIuz "] failed: %s [%d]", atexit_count,
40
0
             winpr_strerror(errno, buffer, sizeof(buffer)), errno);
41
0
    return FALSE;
42
0
  }
43
1
  return TRUE;
44
1
}