diff --git a/src/plugins/output/json/src/File.cpp b/src/plugins/output/json/src/File.cpp index bb24e3cf..85d7b5ce 100644 --- a/src/plugins/output/json/src/File.cpp +++ b/src/plugins/output/json/src/File.cpp @@ -110,6 +110,7 @@ File::File(const struct cfg_file &cfg, ipx_ctx_t *ctx) : Output(cfg.name, ctx) throw std::runtime_error("(File output) Rwlockattr initialization failed!"); } +#ifndef __OpenBSD__ if (pthread_rwlockattr_setkind_np(&attr, PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP) != 0) { if (_thread->m_calg == calg::GZIP) { gzclose((gzFile)_thread->file); @@ -120,6 +121,7 @@ File::File(const struct cfg_file &cfg, ipx_ctx_t *ctx) : Output(cfg.name, ctx) delete _thread; throw std::runtime_error("(File output) Rwlockattr setkind failed!"); } +#endif if (pthread_rwlock_init(&_thread->rwlock, &attr) != 0) { if (_thread->m_calg == calg::GZIP) { @@ -341,7 +343,12 @@ File::dir_create(ipx_ctx_t *ctx, const std::string &path) default: // Other errors char buffer[128]; +#ifdef __OpenBSD__ + char *err_str = buffer; + strerror_r(errno, err_str, 128); +#else const char *err_str = strerror_r(errno, buffer, 128); +#endif IPX_CTX_ERROR(ctx, "(File output) Failed to create a directory %s (%s).", aux_str.c_str(), err_str); return 1; @@ -356,7 +363,12 @@ File::dir_create(ipx_ctx_t *ctx, const std::string &path) if (mkdir(aux_str.c_str(), mask) != 0) { // Failed to create directory char buffer[128]; +#ifdef __OpenBSD__ + char *err_str = buffer; + strerror_r(errno, err_str, 128); +#else const char *err_str = strerror_r(errno, buffer, 128); +#endif IPX_CTX_ERROR(ctx, "(File output) Failed to create a directory %s (%s).", aux_str.c_str(), err_str); return 1; @@ -418,7 +430,12 @@ File::file_create(ipx_ctx_t *ctx, const std::string &tmplt, const std::string &p if (!file) { // Failed to create a flow file char buffer[128]; +#ifdef __OpenBSD__ + char *err_str = buffer; + strerror_r(errno, err_str, 128); +#else const char *err_str = strerror_r(errno, buffer, 128); +#endif IPX_CTX_ERROR(ctx, "Failed to create a flow file '%s' (%s).", file_name.c_str(), err_str); return NULL; }