Skip to content

Commit 6531d12

Browse files
committed
Fix some build failures due to wrong code in gzip handling:
/dlt-daemon/src/offlinelogstorage/dlt_offline_logstorage_behavior.c:1112:48: error: passing argument 1 of 'fileno' from incompatible pointer type [-Wincompatible-pointer-types] 1112 | if (fsync(fileno(config->gzlog)) != 0) { | ~~~~~~^~~~~~~ | | | gzFile {aka struct gzFile_s *} /dlt-daemon/src/offlinelogstorage/dlt_offline_logstorage.c: In function 'dlt_logstorage_filter_config_free': /dlt-daemon/src/offlinelogstorage/dlt_offline_logstorage.c:88:21: error: passing argument 1 of 'gzclose' from incompatible pointer type [-Wincompatible-pointer-types] 88 | gzclose(data->gzlog); | ~~~~^~~~~~~ | | | struct gzFile_s ** In file included from /dlt-daemon/src/offlinelogstorage/dlt_offline_logstorage.h:57, from /dlt-daemon/src/offlinelogstorage/dlt_offline_logstorage.c:32: /usr/include/zlib.h:1634:39: note: expected 'gzFile' {aka 'struct gzFile_s *'} but argument is of type 'struct gzFile_s **' 1634 | ZEXTERN int ZEXPORT gzclose(gzFile file); | ~~~~~~~^~~~ /usr/include/zlib.h:1305:26: note: 'gzFile' declared here 1305 | typedef struct gzFile_s *gzFile; /* semi-opaque gzip file descriptor */ | ^~~~~~
1 parent b651af1 commit 6531d12

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/offlinelogstorage/dlt_offline_logstorage.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ struct DltLogStorageFilterConfig
217217
FILE *log; /* current open log file */
218218
int fd; /* The file descriptor for the active log file */
219219
#ifdef DLT_LOGSTORAGE_USE_GZIP
220-
gzFile *gzlog; /* current open gz log file */
220+
gzFile gzlog; /* current open gz log file */
221221
#endif
222222
void *cache; /* log data cache */
223223
unsigned int specific_size; /* cache size used for specific_size sync strategy */

src/offlinelogstorage/dlt_offline_logstorage_behavior.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1109,7 +1109,7 @@ int dlt_logstorage_prepare_on_msg(DltLogStorageFilterConfig *config,
11091109
(config->sync == DLT_LOGSTORAGE_SYNC_UNSET)) {
11101110
if (config->gzip_compression == DLT_LOGSTORAGE_GZIP_ON) {
11111111
#ifdef DLT_LOGSTORAGE_USE_GZIP
1112-
if (fsync(fileno(config->gzlog)) != 0) {
1112+
if (fsync(config->fd) != 0) {
11131113
if (errno != ENOSYS) {
11141114
dlt_vlog(LOG_ERR, "%s: failed to sync gzip log file\n", __func__);
11151115
}
@@ -1119,7 +1119,7 @@ int dlt_logstorage_prepare_on_msg(DltLogStorageFilterConfig *config,
11191119
#endif
11201120
}
11211121
else {
1122-
if (fsync(fileno(config->log)) != 0) {
1122+
if (fsync(config->fd) != 0) {
11231123
if (errno != ENOSYS) {
11241124
dlt_vlog(LOG_ERR, "%s: failed to sync log file\n", __func__);
11251125
}

0 commit comments

Comments
 (0)