* [PATCH] Monitor: triggers core dump when stat2devnm return NULL
@ 2017-02-14 5:31 Zhilong Liu
2017-02-24 3:05 ` zhilong
2017-02-24 3:06 ` zhilong
0 siblings, 2 replies; 3+ messages in thread
From: Zhilong Liu @ 2017-02-14 5:31 UTC (permalink / raw)
To: Jes.Sorensen; +Cc: linux-raid, Zhilong Liu
ensure that the devnm should be a block device when uses
--wait parameter, such as the 'f' and 'd' type file would
be triggered core dumped.
Signed-off-by: Zhilong Liu <zlliu@suse.com>
diff --git a/Monitor.c b/Monitor.c
index 802a9d9..1900db3 100644
--- a/Monitor.c
+++ b/Monitor.c
@@ -1002,6 +1002,10 @@ int Wait(char *dev)
strerror(errno));
return 2;
}
+ if ((S_IFMT & stb.st_mode) != S_IFBLK) {
+ pr_err("%s is not a block device.\n", dev);
+ return 2;
+ }
strcpy(devnm, stat2devnm(&stb));
while(1) {
diff --git a/lib.c b/lib.c
index b640634..7116298 100644
--- a/lib.c
+++ b/lib.c
@@ -89,9 +89,6 @@ char *devid2kname(int devid)
char *stat2kname(struct stat *st)
{
- if ((S_IFMT & st->st_mode) != S_IFBLK)
- return NULL;
-
return devid2kname(st->st_rdev);
}
--
2.6.6
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] Monitor: triggers core dump when stat2devnm return NULL
2017-02-14 5:31 [PATCH] Monitor: triggers core dump when stat2devnm return NULL Zhilong Liu
@ 2017-02-24 3:05 ` zhilong
2017-02-24 3:06 ` zhilong
1 sibling, 0 replies; 3+ messages in thread
From: zhilong @ 2017-02-24 3:05 UTC (permalink / raw)
To: Jes.Sorensen; +Cc: linux-raid
Hi, Jes;
I just wanted to ping and see if this could get a review:
On 02/14/2017 01:31 PM, Zhilong Liu wrote:
> ensure that the devnm should be a block device when uses
> --wait parameter, such as the 'f' and 'd' type file would
> be triggered core dumped.
>
> Signed-off-by: Zhilong Liu <zlliu@suse.com>
>
> diff --git a/Monitor.c b/Monitor.c
> index 802a9d9..1900db3 100644
> --- a/Monitor.c
> +++ b/Monitor.c
> @@ -1002,6 +1002,10 @@ int Wait(char *dev)
> strerror(errno));
> return 2;
> }
> + if ((S_IFMT & stb.st_mode) != S_IFBLK) {
> + pr_err("%s is not a block device.\n", dev);
> + return 2;
> + }
> strcpy(devnm, stat2devnm(&stb));
>
> while(1) {
> diff --git a/lib.c b/lib.c
> index b640634..7116298 100644
> --- a/lib.c
> +++ b/lib.c
> @@ -89,9 +89,6 @@ char *devid2kname(int devid)
>
> char *stat2kname(struct stat *st)
> {
> - if ((S_IFMT & st->st_mode) != S_IFBLK)
> - return NULL;
> -
> return devid2kname(st->st_rdev);
> }
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Monitor: triggers core dump when stat2devnm return NULL
2017-02-14 5:31 [PATCH] Monitor: triggers core dump when stat2devnm return NULL Zhilong Liu
2017-02-24 3:05 ` zhilong
@ 2017-02-24 3:06 ` zhilong
1 sibling, 0 replies; 3+ messages in thread
From: zhilong @ 2017-02-24 3:06 UTC (permalink / raw)
To: Jes.Sorensen; +Cc: linux-raid
Hi, Jes;
I just wanted to ping and see if this could get a review:
On 02/14/2017 01:31 PM, Zhilong Liu wrote:
> ensure that the devnm should be a block device when uses
> --wait parameter, such as the 'f' and 'd' type file would
> be triggered core dumped.
>
> Signed-off-by: Zhilong Liu <zlliu@suse.com>
>
> diff --git a/Monitor.c b/Monitor.c
> index 802a9d9..1900db3 100644
> --- a/Monitor.c
> +++ b/Monitor.c
> @@ -1002,6 +1002,10 @@ int Wait(char *dev)
> strerror(errno));
> return 2;
> }
> + if ((S_IFMT & stb.st_mode) != S_IFBLK) {
> + pr_err("%s is not a block device.\n", dev);
> + return 2;
> + }
> strcpy(devnm, stat2devnm(&stb));
>
> while(1) {
> diff --git a/lib.c b/lib.c
> index b640634..7116298 100644
> --- a/lib.c
> +++ b/lib.c
> @@ -89,9 +89,6 @@ char *devid2kname(int devid)
>
> char *stat2kname(struct stat *st)
> {
> - if ((S_IFMT & st->st_mode) != S_IFBLK)
> - return NULL;
> -
> return devid2kname(st->st_rdev);
> }
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-02-24 3:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-14 5:31 [PATCH] Monitor: triggers core dump when stat2devnm return NULL Zhilong Liu
2017-02-24 3:05 ` zhilong
2017-02-24 3:06 ` zhilong
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).