Coverage Report

Created: 2023-06-07 06:47

/src/sudo/lib/iolog/iolog_eof.c
Line
Count
Source
1
/*
2
 * SPDX-License-Identifier: ISC
3
 *
4
 * Copyright (c) 2009-2021 Todd C. Miller <Todd.Miller@sudo.ws>
5
 *
6
 * Permission to use, copy, modify, and distribute this software for any
7
 * purpose with or without fee is hereby granted, provided that the above
8
 * copyright notice and this permission notice appear in all copies.
9
 *
10
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17
 */
18
19
/*
20
 * This is an open source non-commercial project. Dear PVS-Studio, please check it.
21
 * PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
22
 */
23
24
#include <config.h>
25
26
#include <stdio.h>
27
#ifdef HAVE_STDBOOL_H
28
# include <stdbool.h>
29
#else
30
# include "compat/stdbool.h"
31
#endif
32
#include <time.h>
33
34
#include "sudo_compat.h"
35
#include "sudo_debug.h"
36
#include "sudo_iolog.h"
37
38
/*
39
 * Returns true if at end of I/O log file, else false.
40
 */
41
bool
42
iolog_eof(struct iolog_file *iol)
43
87
{
44
87
    bool ret;
45
87
    debug_decl(iolog_eof, SUDO_DEBUG_UTIL);
46
47
#ifdef HAVE_ZLIB_H
48
    if (iol->compressed)
49
  ret = gzeof(iol->fd.g) != 0;
50
    else
51
#endif
52
87
  ret = feof(iol->fd.f) != 0;
53
87
    debug_return_int(ret);
54
87
}