include unistd.h in readwrite.h to declare read, write.#80
Merged
Conversation
This was referenced Aug 24, 2019
Member
DerDakon
approved these changes
Aug 24, 2019
read(2) and write(2) are declared in unistd.h. Instead of redeclaring them in readwrite.h, include that system header to get the correct function signature. Note this change also appears in Gentoo's 1.06-readwrite.patch.
eda3e45 to
69cb502
Compare
Contributor
Author
If folks feel I should, I'll modify the patch to match this one, via removal of the whitespace shown there. I wasn't aware of this patch prior to submitting this PR, but I've gone ahead and referenced it in the commit since's it's factually prior art. |
mbhangui
approved these changes
Aug 24, 2019
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
read(2) and write(2) are declared in unistd.h. Instead of redeclaring them in readwrite.h, include that system header to get the correct function signature.
This is the 1.08 portion of the read, write declaration cleanup. The 1.9 portion of this series is PR #43.
This change is necessary for -Wall -Werror, to prevent the following:
./compile qmail-local.c
In file included from exit.h:4:0,
from qmail-local.c:7:
/usr/include/unistd.h:363:16: error: conflicting types for ‘read’
extern ssize_t read (int __fd, void *__buf, size_t __nbytes) __wur;
^~~~
In file included from qmail-local.c:3:0:
readwrite.h:4:12: note: previous declaration of ‘read’ was here
extern int read();
^~~~
Which happens as a side-effect of PR #79, where we include unistd.h everywhere we include exit.h.