Re: [PATCH] Detail.c: do not skip first character when calling xstrdup in Detail()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2/11/19 11:53 PM, Coly Li wrote:
> 'Commit b9c9bd9bacaa ("Detail: ensure --export names are acceptable as
> shell variables")' duplicates mdi->sys_name to sysdev string by,
> 	char *sysdev = xstrdup(mdi->sys_name + 1);
> which skips the first character of mdi->sys_name. Then when running
> mdadm --detail <md device> --export, the output looks like,
> 	MD_DEVICE_ev_sda2_ROLE=1
> 	MD_DEVICE_ev_sda2_DEV=/dev/sda2
> The first character of md device (between MD_DEVICE and _ROLE/_DEV)
> is dropped. The expected output should be,
> 	MD_DEVICE_dev_sda2_ROLE=1
> 	MD_DEVICE_dev_sda2_DEV=/dev/sda2
> 
> This patch removes the '+ 1' from calling xstrdup() in Detail(), which
> gets the dropped first character back.
> 
> Reported-by: Arvin Schnell <aschnell@xxxxxxxx>
> Fixes: b9c9bd9bacaa ("Detail: ensure --export names are acceptable as 4 shell variables")
> Signed-off-by: Coly Li <colyli@xxxxxxx>
> Cc: NeilBrown <neilb@xxxxxxxx>
> ---
>  Detail.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Seems reasonable!

Applied!

Thanks,
Jes




[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux