On Thu, 2009-06-18 at 02:25 +0200, Vladimir 'phcoder' Serbinenko wrote:
> Index: util/hostdisk.c
> ===================================================================
> --- util/hostdisk.c    (revision 2340)
> +++ util/hostdisk.c    (working copy)
> @@ -344,7 +344,7 @@
>  #else /* ! __linux__ */
>  #if defined (__FreeBSD__) || defined(__FreeBSD_kernel__)
>    int sysctl_flags, sysctl_oldflags;
> -  const size_t sysctl_size = sizeof (sysctl_flags);
> +  size_t sysctl_size = sizeof (sysctl_flags);
>  
>    if (sysctlbyname ("kern.geom.debugflags", &sysctl_oldflags,
> &sysctl_size, NULL, 0))

We use sysctl_size twice after that call.  If it's not constant, chances
are that it has changed.  Shouldn't we revert to the original value, or
should we use the returned value in the subsequent calls?

I've seen that warning and I considered that patch, but I didn't have a
chance to check the correctness of the change.  Just silencing the
warning is not good.  We should actually make sure that the problem is
fixed.

>      {
> @@ -833,6 +833,7 @@
>  #endif
>  }
>  
> +#if defined(__linux__) || defined(__CYGWIN__)
>  static int
>  device_is_wholedisk (const char *os_dev)
>  {
> @@ -842,6 +843,7 @@
>      return 1;
>    return 0;
>  }
> +#endif

That's good.
 
>  static int
>  find_system_device (const char *os_dev)
> @@ -1045,7 +1047,7 @@
>  
>      if (strncmp ("/dev/", os_dev, 5) == 0)
>        {
> -        char *p, *q;
> +        const char *p, *q;
>          long int n;
>  
>          for (p = os_dev + 5; *p; ++p)
> @@ -1055,7 +1057,7 @@
>                if (p)
>                  {
>                    p++;
> -                  n = strtol (p, &q, 10);
> +                  n = strtol (p, (char **) &q, 10);

Casts to remove "const" look like hacks to me.  Again, it's better to
keep a warning that to have such code.

-- 
Regards,
Pavel Roskin


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to