* grub-core/net/bootp.c (set_env_limn_ro): Make pointer const.
(parse_dhcp_vendor): Likewise.
This commit is contained in:
parent
7cb24eb5ff
commit
f06c2172c0
2 changed files with 25 additions and 14 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2013-11-07 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* grub-core/net/bootp.c (set_env_limn_ro): Make pointer const.
|
||||||
|
(parse_dhcp_vendor): Likewise.
|
||||||
|
|
||||||
2013-11-07 Vladimir Serbinenko <phcoder@gmail.com>
|
2013-11-07 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
* util/grub-mkimagexx.c (relocate_symbols): Remove unneeded brackets.
|
* util/grub-mkimagexx.c (relocate_symbols): Remove unneeded brackets.
|
||||||
|
|
|
@ -34,30 +34,36 @@ grub_env_write_readonly (struct grub_env_var *var __attribute__ ((unused)),
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_env_limn_ro (const char *intername, const char *suffix,
|
set_env_limn_ro (const char *intername, const char *suffix,
|
||||||
char *value, grub_size_t len)
|
const char *value, grub_size_t len)
|
||||||
{
|
{
|
||||||
char c;
|
char *varname, *varvalue;
|
||||||
char *varname;
|
|
||||||
char *ptr;
|
char *ptr;
|
||||||
varname = grub_xasprintf ("net_%s_%s", intername, suffix);
|
varname = grub_xasprintf ("net_%s_%s", intername, suffix);
|
||||||
if (!varname)
|
if (!varname)
|
||||||
return;
|
return;
|
||||||
for (ptr = varname; *ptr; ptr++)
|
for (ptr = varname; *ptr; ptr++)
|
||||||
if (*ptr == ':')
|
if (*ptr == ':')
|
||||||
*ptr = '_';
|
*ptr = '_';
|
||||||
c = value[len];
|
varvalue = grub_malloc (len + 1);
|
||||||
value[len] = 0;
|
if (!varvalue)
|
||||||
grub_env_set (varname, value);
|
{
|
||||||
value[len] = c;
|
grub_free (varname);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
grub_memcpy (varvalue, value, len);
|
||||||
|
varvalue[len] = 0;
|
||||||
|
grub_env_set (varname, varvalue);
|
||||||
grub_register_variable_hook (varname, 0, grub_env_write_readonly);
|
grub_register_variable_hook (varname, 0, grub_env_write_readonly);
|
||||||
grub_env_export (varname);
|
grub_env_export (varname);
|
||||||
grub_free (varname);
|
grub_free (varname);
|
||||||
|
grub_free (varvalue);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
parse_dhcp_vendor (const char *name, void *vend, int limit, int *mask)
|
parse_dhcp_vendor (const char *name, const void *vend, int limit, int *mask)
|
||||||
{
|
{
|
||||||
grub_uint8_t *ptr, *ptr0;
|
const grub_uint8_t *ptr, *ptr0;
|
||||||
|
|
||||||
ptr = ptr0 = vend;
|
ptr = ptr0 = vend;
|
||||||
|
|
||||||
|
@ -130,19 +136,19 @@ parse_dhcp_vendor (const char *name, void *vend, int limit, int *mask)
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
case GRUB_NET_BOOTP_HOSTNAME:
|
case GRUB_NET_BOOTP_HOSTNAME:
|
||||||
set_env_limn_ro (name, "hostname", (char *) ptr, taglength);
|
set_env_limn_ro (name, "hostname", (const char *) ptr, taglength);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GRUB_NET_BOOTP_DOMAIN:
|
case GRUB_NET_BOOTP_DOMAIN:
|
||||||
set_env_limn_ro (name, "domain", (char *) ptr, taglength);
|
set_env_limn_ro (name, "domain", (const char *) ptr, taglength);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GRUB_NET_BOOTP_ROOT_PATH:
|
case GRUB_NET_BOOTP_ROOT_PATH:
|
||||||
set_env_limn_ro (name, "rootpath", (char *) ptr, taglength);
|
set_env_limn_ro (name, "rootpath", (const char *) ptr, taglength);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GRUB_NET_BOOTP_EXTENSIONS_PATH:
|
case GRUB_NET_BOOTP_EXTENSIONS_PATH:
|
||||||
set_env_limn_ro (name, "extensionspath", (char *) ptr, taglength);
|
set_env_limn_ro (name, "extensionspath", (const char *) ptr, taglength);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* If you need any other options please contact GRUB
|
/* If you need any other options please contact GRUB
|
||||||
|
|
Loading…
Reference in a new issue