[OpenWrt-Devel] [PATCH mountd 2/2] support for disk without partition table

John Crispin john at phrozen.org
Thu Jun 23 03:24:14 EDT 2016



On 22/06/2016 09:51, olivier.hardouin at gmail.com wrote:
> if no partition found, try to mount the block device itself
> 
> Signed-off-by: Olivier Hardouin <olivier.hardouin at gmail.com>

Hi,

looks ok, just wondering what kind of storage you see this on. i have
only seen superfloppy type formating on mmc cards and that is almost a
decade ago.

	John

> ---
>  mount.c | 14 ++++++++++----
>  1 file changed, 10 insertions(+), 4 deletions(-)
> 
> diff --git a/mount.c b/mount.c
> index 0c2862a..7cbb8ff 100644
> --- a/mount.c
> +++ b/mount.c
> @@ -693,13 +693,19 @@ static void mount_enum_drives(void)
>  				char tmp[64];
>  				snprintf(tmp, 64, "/sys/block/%s/", namelist[n]->d_name);
>  				m = scandir(tmp, &namelist2, dir_filter2, dir_sort);
> -				while(m--)
> +				if(m > 0)
>  				{
> -					strncpy(&block[blk_cnt][0], namelist2[m]->d_name, MAX_BLOCK);
> +					while(m--)
> +					{
> +						strncpy(&block[blk_cnt][0], namelist2[m]->d_name, MAX_BLOCK);
> +						blk_cnt++;
> +						free(namelist2[m]);
> +					}
> +					free(namelist2);
> +				} else {
> +					strncpy(&block[blk_cnt][0], namelist[n]->d_name, MAX_BLOCK);
>  					blk_cnt++;
> -					free(namelist2[m]);
>  				}
> -				free(namelist2);
>  			}
>  			free(namelist[n]);
>  		}
> 
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


More information about the openwrt-devel mailing list