Skip to content

Commit

Permalink
nss: Fix warnings generated by getcwd
Browse files Browse the repository at this point in the history
getcwd() conforms to POSIX.1-2001 which leaves the behaviour when the
buf argument is NULL, undefined. This makes gcc 10+ throw the following
warning:

argument 1 is null but the corresponding size argument 2 value is 4096

Initially, this was fixed by disabling NSS_ENABLE_WERROR. This patch
re-enables NSS_ENABLE_WERROR (by leaving it to its default value) and
takes advantage of the existing functionality in nss that wraps the
getcwd call into a function making sure that the buf argument is always
properly allocated.

Signed-off-by: Andrei Gherzan <andrei.gherzan@huawei.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
  • Loading branch information
Andrei Gherzan authored and kraj committed Mar 4, 2021
1 parent 5593fac commit dad2aef
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion meta-oe/recipes-support/nss/nss_3.60.1.bb
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,17 @@ do_compile_prepend_class-native() {

do_compile() {
export NSPR_INCLUDE_DIR=${STAGING_INCDIR}/nspr
export NSS_ENABLE_WERROR=0

export CROSS_COMPILE=1
export NATIVE_CC="${BUILD_CC}"
# Additional defines needed on Centos 7
export NATIVE_FLAGS="${BUILD_CFLAGS} -DLINUX -Dlinux"
export BUILD_OPT=1

# POSIX.1-2001 states that the behaviour of getcwd() when passing a null
# pointer as the buf argument, is unspecified.
export NATIVE_FLAGS="${NATIVE_FLAGS} -DGETCWD_CANT_MALLOC"

export FREEBL_NO_DEPEND=1
export FREEBL_LOWHASH=1

Expand Down

0 comments on commit dad2aef

Please sign in to comment.