summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cli.c2
-rw-r--r--pci.c6
2 files changed, 5 insertions, 3 deletions
diff --git a/cli.c b/cli.c
index 5ab0962..16151fc 100644
--- a/cli.c
+++ b/cli.c
@@ -655,7 +655,7 @@ int main(int argc, char **argv) {
else Usage(argc, argv, NULL);
}
- pcilib_set_error_handler(&Error, &Error);
+ pcilib_set_error_handler(&Error, NULL);
handle = pcilib_open(fpga_device, model);
if (handle < 0) Error("Failed to open FPGA device: %s", fpga_device);
diff --git a/pci.c b/pci.c
index c6c37c9..461d2f3 100644
--- a/pci.c
+++ b/pci.c
@@ -53,8 +53,10 @@ void (*pcilib_error)(const char *msg, ...) = pcilib_print_error;
void (*pcilib_warning)(const char *msg, ...) = pcilib_print_error;
int pcilib_set_error_handler(void (*err)(const char *msg, ...), void (*warn)(const char *msg, ...)) {
- pcilib_error = err;
- pcilib_warning = warn;
+ if (err) pcilib_error = err;
+ else pcilib_error = pcilib_print_error;
+ if (warn) pcilib_warning = warn;
+ else pcilib_warning = pcilib_print_error;
}
pcilib_t *pcilib_open(const char *device, pcilib_model_t model) {