Skip to content

Commit 9fc1a28

Browse files
committed
Unirec output plugin: fixed a missing error message in case of failure during processing a mapping configuration file
1 parent 488edf8 commit 9fc1a28

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

extra_plugins/output/unirec/map.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
#include <ipfixcol2.h>
4646
#include <ctype.h>
4747
#include <inttypes.h>
48+
#include <errno.h>
4849

4950
/** Default size of the mapping database */
5051
#define DEF_SIZE 32
@@ -289,6 +290,10 @@ map_load(map_t *map, const char *file)
289290
// Open the file
290291
FILE *ur_file = fopen(file, "r");
291292
if (!ur_file) {
293+
const char *err_str;
294+
ipx_strerror(errno, err_str);
295+
snprintf(map->err_buffer, ERR_SIZE, "Failed to open configuration file '%s': %s",
296+
file, err_str);
292297
return IPX_ERR_DENIED;
293298
}
294299

extra_plugins/output/unirec/map.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ map_destroy(map_t *map);
8282

8383
/**
8484
* \brief Load a mapping database from a file
85+
*
86+
* \note In case of an error, an error message is filled (see map_last_error())
8587
* \param[in] map Mapping database
8688
* \param[in] file Path to the file
8789
* \return #IPX_OK on success

0 commit comments

Comments
 (0)