Skip to content

Commit 7461ec4

Browse files
committed
Fix build when zlib is not installed
1 parent 18bed45 commit 7461ec4

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/offlinelogstorage/dlt_offline_logstorage.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@
5353

5454
#include <search.h>
5555
#include <stdbool.h>
56+
#ifdef DLT_LOGSTORAGE_USE_GZIP
5657
#include <zlib.h>
58+
#endif
5759
#include "dlt_common.h"
5860
#include "dlt-daemon_cfg.h"
5961
#include "dlt_config_file_parser.h"
@@ -214,7 +216,9 @@ struct DltLogStorageFilterConfig
214216
int status);
215217
FILE *log; /* current open log file */
216218
int fd; /* The file descriptor for the active log file */
219+
#ifdef DLT_LOGSTORAGE_USE_GZIP
217220
gzFile *gzlog; /* current open gz log file */
221+
#endif
218222
void *cache; /* log data cache */
219223
unsigned int specific_size; /* cache size used for specific_size sync strategy */
220224
unsigned int current_write_file_offset; /* file offset for specific_size sync strategy */

src/offlinelogstorage/dlt_offline_logstorage_behavior.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1108,11 +1108,15 @@ int dlt_logstorage_prepare_on_msg(DltLogStorageFilterConfig *config,
11081108
if ((config->sync == DLT_LOGSTORAGE_SYNC_ON_MSG) ||
11091109
(config->sync == DLT_LOGSTORAGE_SYNC_UNSET)) {
11101110
if (config->gzip_compression == DLT_LOGSTORAGE_GZIP_ON) {
1111-
if (fsync(fileno(config->gzlog)) != 0) {
1111+
#ifdef DLT_LOGSTORAGE_USE_GZIP
1112+
if (fsync(fileno(config->gzlog)) != 0) {
11121113
if (errno != ENOSYS) {
11131114
dlt_vlog(LOG_ERR, "%s: failed to sync gzip log file\n", __func__);
11141115
}
11151116
}
1117+
#else
1118+
dlt_vlog(LOG_ERR, "%s: dlt-daemon not compiled with logstorage gzip support\n", __func__);
1119+
#endif
11161120
}
11171121
else {
11181122
if (fsync(fileno(config->log)) != 0) {

0 commit comments

Comments
 (0)