Skip to content

include unistd.h in readwrite.h to declare read, write.#80

Merged
alanpost merged 1 commit into
notqmail:masterfrom
alanpost:pr-include-unistd-readwrite-h
Aug 24, 2019
Merged

include unistd.h in readwrite.h to declare read, write.#80
alanpost merged 1 commit into
notqmail:masterfrom
alanpost:pr-include-unistd-readwrite-h

Conversation

@alanpost
Copy link
Copy Markdown
Contributor

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.

@DerDakon
Copy link
Copy Markdown
Member

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.
@alanpost alanpost force-pushed the pr-include-unistd-readwrite-h branch from eda3e45 to 69cb502 Compare August 24, 2019 18:12
@alanpost
Copy link
Copy Markdown
Contributor Author

For reference: https://github.com/gentoo/gentoo/blob/master/mail-mta/netqmail/files/1.06-readwrite.patch

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.

@alanpost alanpost merged commit ff45251 into notqmail:master Aug 24, 2019
@alanpost alanpost deleted the pr-include-unistd-readwrite-h branch August 25, 2019 14:16
@DerDakon DerDakon modified the milestones: 1.09, 1.08 Dec 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants