aboutsummaryrefslogtreecommitdiffstats
path: root/src/zperror.c
blob: 5d5d11ab5e12a1cea807e582bf9181ed15fad510 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/* See LICENSE file for copyright and license details. */
#include "internals.h"

#include <stdio.h>


void
zperror(const char *prefix)
{
	if (libzahl_error >= 0) {
		errno = libzahl_error;
		perror(prefix);
	} else {
		const char *desc;
		zerror(&desc);
		if (prefix && *prefix)
			fprintf(stderr, "%s: %s\n", prefix, desc);
		else
			fprintf(stderr, "%s\n", desc);
	}
}