Re: [PATCH] mount: make the --offset option support hex number

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

 



On Thu, Mar 25, 2010 at 1:19 PM, Liu Aleaxander <aleaxander@xxxxxxxxx> wrote:
> --- a/mount/lomount.c
> +++ b/mount/lomount.c
> @@ -1015,8 +1015,14 @@ main(int argc, char **argv) {
>                        usage();
>        }
>
> -       if (offset && sscanf(offset, "%llu", &off) != 1)
> -               usage();
> +       if (offset) {
> +               char *end;
> +               off = strtoull(offset, &end, 0);
> +               if (*end) {
> +                       fprintf(stderr, _("%s is not a valid
> number\n"), offset);
> +                       return -1;
> +               }
> +       }

Sorry, this is still not right. Please refer strtoul(2), you need
to check if end == offset.
��.n��������+%������w��{.n�����)��)����jg��������ݢj����G�������j:+v���w�m������w�������h�����٥


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux