Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pkg/unshare: fix implicit declaration of basename function #1920

Merged
merged 1 commit into from
May 13, 2024
Merged

pkg/unshare: fix implicit declaration of basename function #1920

merged 1 commit into from
May 13, 2024

Conversation

nmeum
Copy link
Contributor

@nmeum nmeum commented May 12, 2024

POSIX requires the prototype of the basename function to be declared in the libgen.h header file. Therefore, this header file needs to be included in order to make use of this function in a POSIX environment. The unshare.c source file uses this function here (without including libgen.h):

exename = basename(argv[0]);

Some implementations, e.g. glibc, also define this function in string.h. However, musl (for example) only defines it in libgen.h causing it be implicitly declared (with an int return type) which is by no means cosmetic and can lead to severe miscompilations.

POSIX requires the prototype of the basename function to be declared
in the libgen.h header file. Therefore, this header file needs to be
included in order to make use of this function in a POSIX environment.

Some implementations, e.g. glibc, also define this function in string.h.
However, musl (for example) only defines it in libgen.h causing it be
implicitly declared (with an `int` return type) which is by no means
cosmetic and can lead to severe miscompilations.

Signed-off-by: Sören Tempel <[email protected]>
@saschagrunert
Copy link
Member

@nmeum may I ask you to DCO sign-off your commit?

Copy link
Contributor

openshift-ci bot commented May 13, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: nmeum, saschagrunert

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@nmeum
Copy link
Contributor Author

nmeum commented May 13, 2024

Oppsi, sorry forgot about that! Should be fixed now :)

@rhatdan
Copy link
Member

rhatdan commented May 13, 2024

LGTM

@rhatdan
Copy link
Member

rhatdan commented May 13, 2024

/lgtm

@rhatdan
Copy link
Member

rhatdan commented May 13, 2024

Thanks @nmeum

@openshift-merge-bot openshift-merge-bot bot merged commit f0ec350 into containers:main May 13, 2024
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants