From: NeilBrown <nfbrown@novell.com>
To: linux-raid@vger.kernel.org
Cc: Khem Raj <raj.khem@gmail.com>
Subject: Re: [PATCH] Define _POSIX_C_SOURCE if undefined
Date: Thu, 14 Jan 2016 11:40:18 +1100 [thread overview]
Message-ID: <87mvs96ljh.fsf@notabene.neil.brown.name> (raw)
In-Reply-To: <1452671964-35006-1-git-send-email-raj.khem@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 2161 bytes --]
On Wed, Jan 13 2016, Khem Raj wrote:
> typecast second argument of connect() API to use struct sockaddr*
>
Hi,
You have told us what this patch does, but not why anyone should care.
Just a sentence or two is probably enough. Are you getting compiler
warnings (if so, what are they). Are we violating some standard (which
one).
Is there a connection between defining _POSIX_C_SOURCE (as described in
the subject) and the second argument to connect (as mentioned in the
comment above) and the second argument to bind (as not mentioned until
the code).
Please explain.
Thanks,
NeilBrown
> Signed-off-by: Khem Raj <raj.khem@gmail.com>
> ---
> config.c | 3 +++
> mdmon.c | 2 +-
> msg.c | 2 +-
> 3 files changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/config.c b/config.c
> index c58c8fe..b308b6c 100644
> --- a/config.c
> +++ b/config.c
> @@ -63,6 +63,9 @@
> * but may not wrap over lines
> *
> */
> +#ifndef _POSIX_C_SOURCE
> +#define _POSIX_C_SOURCE 200809L
> +#endif
>
> #ifndef CONFFILE
> #define CONFFILE "/etc/mdadm.conf"
> diff --git a/mdmon.c b/mdmon.c
> index ee12b7c..e4b73d9 100644
> --- a/mdmon.c
> +++ b/mdmon.c
> @@ -235,7 +235,7 @@ static int make_control_sock(char *devname)
> addr.sun_family = PF_LOCAL;
> strcpy(addr.sun_path, path);
> umask(077); /* ensure no world write access */
> - if (bind(sfd, &addr, sizeof(addr)) < 0) {
> + if (bind(sfd, (struct sockaddr*)&addr, sizeof(addr)) < 0) {
> close(sfd);
> return -1;
> }
> diff --git a/msg.c b/msg.c
> index 754630b..45cd450 100644
> --- a/msg.c
> +++ b/msg.c
> @@ -170,7 +170,7 @@ int connect_monitor(char *devname)
>
> addr.sun_family = PF_LOCAL;
> strcpy(addr.sun_path, path);
> - if (connect(sfd, &addr, sizeof(addr)) < 0) {
> + if (connect(sfd, (struct sockaddr*)&addr, sizeof(addr)) < 0) {
> close(sfd);
> return -1;
> }
> --
> 2.7.0
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-raid" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]
next prev parent reply other threads:[~2016-01-14 0:40 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-13 7:59 [PATCH] Define _POSIX_C_SOURCE if undefined Khem Raj
2016-01-14 0:40 ` NeilBrown [this message]
2016-01-14 4:02 ` Khem Raj
2016-01-14 5:36 ` NeilBrown
-- strict thread matches above, loose matches on Subject: below --
2016-01-13 8:03 Khem Raj
2016-01-13 7:51 Khem Raj
2016-01-13 7:40 Khem Raj
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87mvs96ljh.fsf@notabene.neil.brown.name \
--to=nfbrown@novell.com \
--cc=linux-raid@vger.kernel.org \
--cc=raj.khem@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).