Skip to content

Commit

Permalink
Merge pull request #2095 from evgenyz/fix-warning-1.4-1558
Browse files Browse the repository at this point in the history
Fix last remaining warning and enable CMAKE_COMPILE_WARNING_AS_ERROR in Gating CI jobs (Fedora/Ubuntu)
  • Loading branch information
jan-cerny authored May 2, 2024
2 parents 2b9af37 + 529d129 commit c3c695c
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 17 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
- name: Install Deps
run: |
sudo apt-get update
sudo apt-get -y install lcov swig xsltproc rpm-common lua5.3 libpcre2-dev libyaml-dev libdbus-1-dev libdbus-glib-1-dev libcurl4-openssl-dev libgcrypt-dev libselinux1-dev libgconf2-dev libacl1-dev libblkid-dev libcap-dev libxml2-dev libxslt1-dev libxml-parser-perl libxml-xpath-perl libperl-dev librpm-dev librtmp-dev libxmlsec1-dev libxmlsec1-openssl python3-dbusmock python3-pytest
sudo apt-get -y install lcov swig xsltproc rpm-common lua5.3 libpcre2-dev libyaml-dev libdbus-1-dev libdbus-glib-1-dev libcurl4-openssl-dev libgcrypt-dev libselinux1-dev libacl1-dev libblkid-dev libcap-dev libxml2-dev libxslt1-dev libxml-parser-perl libxml-xpath-perl libperl-dev librpm-dev librtmp-dev libxmlsec1-dev libxmlsec1-openssl python3-dbusmock python3-pytest
sudo apt-get -y remove rpm
# Runs a set of commands using the runners shell
Expand All @@ -57,15 +57,15 @@ jobs:
image: fedora:latest
steps:
- name: Install Deps
run: dnf install -y cmake git dbus-devel GConf2-devel libacl-devel libblkid-devel libcap-devel libcurl-devel libgcrypt-devel libselinux-devel libxml2-devel libxslt-devel libattr-devel make openldap-devel pcre2-devel perl-XML-Parser perl-XML-XPath perl-devel python3-devel python3-dbusmock rpm-devel swig bzip2-devel gcc-c++ libyaml-devel xmlsec1-devel xmlsec1-openssl-devel hostname bzip2 lua rpm-build which strace python3-pytest
run: dnf install -y cmake git procps-ng dbus-devel libacl-devel libblkid-devel libcap-devel libcurl-devel libgcrypt-devel libselinux-devel libxml2-devel libxslt-devel libattr-devel make openldap-devel pcre2-devel perl-XML-Parser perl-XML-XPath perl-devel python3-devel python3-dbusmock rpm-devel swig bzip2-devel gcc-c++ libyaml-devel xmlsec1-devel xmlsec1-openssl-devel hostname bzip2 lua rpm-build which strace python3-pytest
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Build
working-directory: ./build
run: |
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DWITH_PCRE2=True ../
cmake -DCMAKE_COMPILE_WARNING_AS_ERROR=True -DCMAKE_BUILD_TYPE=RelWithDebInfo -DWITH_PCRE2=True ../
make all
- name: Test
working-directory: ./build
Expand All @@ -80,7 +80,7 @@ jobs:
image: fedora:rawhide
steps:
- name: Install Deps
run: dnf install -y cmake git dbus-devel GConf2-devel libacl-devel libblkid-devel libcap-devel libcurl-devel nss-devel libselinux-devel libxml2-devel libxslt-devel libattr-devel make openldap-devel pcre2-devel perl-XML-Parser perl-XML-XPath perl-devel python3-devel python3-dbusmock rpm-devel swig bzip2-devel gcc-c++ libyaml-devel xmlsec1-devel xmlsec1-openssl-devel hostname bzip2 lua rpm-build which strace python3-pytest
run: dnf install -y cmake git procps-ng dbus-devel libacl-devel libblkid-devel libcap-devel libcurl-devel nss-devel libselinux-devel libxml2-devel libxslt-devel libattr-devel make openldap-devel pcre2-devel perl-XML-Parser perl-XML-XPath perl-devel python3-devel python3-dbusmock rpm-devel swig bzip2-devel gcc-c++ libyaml-devel xmlsec1-devel xmlsec1-openssl-devel hostname bzip2 lua rpm-build which strace python3-pytest
- name: Checkout
uses: actions/checkout@v3
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: "CodeQL"

on:
push:
branches: [ 'maint-1.3', 'maint-1.2', 'master' ]
branches: [ 'maint-1.3', 'maint-1.2', 'main' ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ 'maint-1.3' ]
Expand Down
4 changes: 2 additions & 2 deletions src/CPE/cpedict_priv.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ struct cpe_item { // the node <cpe-item>
} export;
};
OSCAP_GETTER(struct cpe_name *, cpe_item, name)
OSCAP_SETTER_GENERIC(cpe_item, const struct cpe_name *, name, cpe_name_free, )
OSCAP_SETTER_GENERIC(cpe_item, struct cpe_name *, name, cpe_name_free, )
OSCAP_GETTER(struct cpe_name *, cpe_item, deprecated_by)
OSCAP_SETTER_GENERIC(cpe_item, const struct cpe_name *, deprecated_by, cpe_name_free, )
OSCAP_SETTER_GENERIC(cpe_item, struct cpe_name *, deprecated_by, cpe_name_free, )
OSCAP_ACCESSOR_STRING(cpe_item, deprecation_date)
OSCAP_GETTER(struct cpe_item_metadata *, cpe_item, metadata)
OSCAP_IGETINS_GEN(cpe_reference, cpe_item, references, reference)
Expand Down
4 changes: 2 additions & 2 deletions src/CPE/public/cpe_dict.h
Original file line number Diff line number Diff line change
Expand Up @@ -421,10 +421,10 @@ OSCAP_API struct cpe_item_metadata *cpe_item_metadata_new(void);
*/

/// @memberof cpe_item
OSCAP_API bool cpe_item_set_name(struct cpe_item *item, const struct cpe_name *new_name);
OSCAP_API bool cpe_item_set_name(struct cpe_item *item, struct cpe_name *new_name);

/// @memberof cpe_item
OSCAP_API bool cpe_item_set_deprecated_by(struct cpe_item *item, const struct cpe_name *new_deprecated_by);
OSCAP_API bool cpe_item_set_deprecated_by(struct cpe_item *item, struct cpe_name *new_deprecated_by);

/// @memberof cpe_item
OSCAP_API bool cpe_item_set_deprecation_date(struct cpe_item *item, const char *new_deprecation_date);
Expand Down
7 changes: 4 additions & 3 deletions src/OVAL/probes/independent/filehash58_probe.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,9 @@ static int filehash58_cb(const char *prefix, const char *p, const char *f, const
}

if (fd < 0) {
strerror_r (errno, pbuf, PATH_MAX);
pbuf[PATH_MAX] = '\0';
#define __ERRBUF_SIZE 128
char errbuf[__ERRBUF_SIZE] = {0};
oscap_strerror_r(errno, errbuf, sizeof errbuf - 1);

itm = probe_item_create (OVAL_INDEPENDENT_FILE_HASH58, NULL,
"filepath", OVAL_DATATYPE_STRING, pbuf,
Expand All @@ -178,7 +179,7 @@ static int filehash58_cb(const char *prefix, const char *p, const char *f, const
"hash_type",OVAL_DATATYPE_STRING, h,
NULL);
probe_item_add_msg(itm, OVAL_MESSAGE_LEVEL_ERROR,
"Can't open \"%s\": errno=%d, %s.", pbuf, errno, strerror (errno));
"Can't open \"%s\": %s (errno=%d).", pbuf, errbuf, errno);
probe_item_setstatus(itm, SYSCHAR_STATUS_ERROR);

probe_item_collect(ctx, itm);
Expand Down
7 changes: 4 additions & 3 deletions src/OVAL/probes/independent/filehash_probe.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,9 @@ static int filehash_cb (const char *prefix, const char *p, const char *f, probe_
}

if (fd < 0) {
strerror_r (errno, pbuf, PATH_MAX);
pbuf[PATH_MAX] = '\0';
#define __ERRBUF_SIZE 128
char errbuf[__ERRBUF_SIZE] = {0};
oscap_strerror_r(errno, errbuf, sizeof errbuf - 1);

itm = probe_item_create(OVAL_INDEPENDENT_FILE_HASH, NULL,
"filepath", OVAL_DATATYPE_STRING, include_filepath ? pbuf : NULL,
Expand All @@ -131,7 +132,7 @@ static int filehash_cb (const char *prefix, const char *p, const char *f, probe_
NULL
);
probe_item_add_msg(itm, OVAL_MESSAGE_LEVEL_ERROR,
"Can't open \"%s\": errno=%d, %s.", pbuf, errno, strerror (errno));
"Can't open \"%s\": %s (errno=%d).", pbuf, errbuf, errno);
probe_item_setstatus(itm, SYSCHAR_STATUS_ERROR);

} else {
Expand Down
6 changes: 4 additions & 2 deletions src/common/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -363,8 +363,10 @@ static inline void *oscap_aligned_malloc(size_t size, size_t alignment) {
return _aligned_malloc(size, alignment);
#else
void *ptr = NULL;
posix_memalign(&ptr, alignment, size);
return ptr;
int ret = posix_memalign(&ptr, alignment, size);
if (ret == 0)
return ptr;
return NULL;
#endif
}

Expand Down

0 comments on commit c3c695c

Please sign in to comment.