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

Fix getmntent check with -Werror. #799

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

gonsolo
Copy link
Contributor

@gonsolo gonsolo commented May 18, 2023

Fix a warning. The test is just compile tested and the return value is not used anyway.
Also, in my private build I compile with "-Werror" and without this patch this fails.

It also fails to build:
../libs/pbd/mountpoint.cc:114:10: fatal error: sys/ucred.h: Datei oder Verzeichnis nicht gefunden 114 | #include <sys/ucred.h> | ^~~~~~~~~~~~~ compilation terminated.

@gonsolo
Copy link
Contributor Author

gonsolo commented May 24, 2023

The test program cannot be run. It always fails with a segmentation fault. A better one would be:

FILE *f = setmntent("/", "r");
if (f) { endmntent(f); }

@x42
Copy link
Member

x42 commented May 25, 2023

The test is not executed, but it needs to compile without warning if OP wants to use -Werror.

@kiilerix
Copy link
Contributor

The current check script will however compile even if mntent.h doesn't contain getmntent. The default declaration of getmntent is fine.

The check could thus be simplified to
msg="Checking for mntent.h", fragment = "#include <mntent.h>",
which I assume also works fine for the use case of -Werror.

A more (pointless) thorough check that checks for valid content of mntent.h could perhaps also do
struct mntent *tmp = getmntent(0);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants