GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: lib/libc/nls/catclose.c Lines: 0 7 0.0 %
Date: 2017-11-13 Branches: 0 4 0.0 %

Line Branch Exec Source
1
/*	$OpenBSD: catclose.c,v 1.8 2015/09/05 11:25:30 guenther Exp $ */
2
/*-
3
 * Copyright (c) 1996 The NetBSD Foundation, Inc.
4
 * All rights reserved.
5
 *
6
 * This code is derived from software contributed to The NetBSD Foundation
7
 * by J.T. Conklin.
8
 *
9
 * Redistribution and use in source and binary forms, with or without
10
 * modification, are permitted provided that the following conditions
11
 * are met:
12
 * 1. Redistributions of source code must retain the above copyright
13
 *    notice, this list of conditions and the following disclaimer.
14
 * 2. Redistributions in binary form must reproduce the above copyright
15
 *    notice, this list of conditions and the following disclaimer in the
16
 *    documentation and/or other materials provided with the distribution.
17
 *
18
 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
19
 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20
 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
22
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28
 * POSSIBILITY OF SUCH DAMAGE.
29
 */
30
31
#define _NLS_PRIVATE
32
33
#include <sys/types.h>
34
#include <sys/mman.h>
35
#include <errno.h>
36
#include <nl_types.h>
37
#include <stdlib.h>
38
39
int
40
catclose(nl_catd catd)
41
{
42
	if (catd == (nl_catd) -1) {
43
		errno = EBADF;
44
		return -1;
45
	}
46
47
	if (catd) {
48
		munmap(catd->__data, catd->__size);
49
		free (catd);
50
	}
51
52
	return 0;
53
}
54
DEF_WEAK(catclose);