mirror of
https://src.fedoraproject.org/rpms/grub2.git
synced 2024-11-28 15:46:53 +00:00
7e98da058f
This change reorganizes and cleanups our patches to reduce the patch number from 314 patches to 187. That's achieved by dropping patches that are later reverted and squashing fixes for earlier patches that introduced features. There are no code changes and the diff with upstream is the same before and after the cleanup. Having fewer patches makes easier to manage the patchset and also will ease to rebase them on top of the latest grub-2.04 release. Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
592 lines
20 KiB
Diff
592 lines
20 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Peter Jones <pjones@redhat.com>
|
|
Date: Fri, 19 Oct 2018 13:41:48 -0400
|
|
Subject: [PATCH] Make grub_strtoul "end" pointer have the right
|
|
constification.
|
|
|
|
Related: rhbz#1640979
|
|
Signed-off-by: Peter Jones <pjones@redhat.com>
|
|
---
|
|
grub-core/commands/date.c | 5 +++--
|
|
grub-core/commands/password_pbkdf2.c | 2 +-
|
|
grub-core/commands/regexp.c | 2 +-
|
|
grub-core/commands/videoinfo.c | 2 +-
|
|
grub-core/disk/diskfilter.c | 3 ++-
|
|
grub-core/disk/lvm.c | 9 +++++----
|
|
grub-core/kern/fs.c | 2 +-
|
|
grub-core/kern/misc.c | 8 ++++----
|
|
grub-core/kern/partition.c | 2 +-
|
|
grub-core/lib/arg.c | 2 +-
|
|
grub-core/lib/legacy_parse.c | 2 +-
|
|
grub-core/lib/syslinux_parse.c | 6 +++---
|
|
grub-core/loader/i386/xen_fileXX.c | 2 +-
|
|
grub-core/net/efi/ip4_config.c | 2 +-
|
|
grub-core/net/efi/ip6_config.c | 2 +-
|
|
grub-core/net/efi/net.c | 4 ++--
|
|
grub-core/net/efi/pxe.c | 6 +++---
|
|
grub-core/net/http.c | 4 ++--
|
|
grub-core/net/net.c | 8 ++++----
|
|
grub-core/net/url.c | 2 +-
|
|
grub-core/osdep/devmapper/hostdisk.c | 2 +-
|
|
grub-core/script/execute.c | 6 +++---
|
|
grub-core/term/serial.c | 2 +-
|
|
grub-core/term/terminfo.c | 2 +-
|
|
grub-core/tests/strtoull_test.c | 2 +-
|
|
util/grub-fstest.c | 2 +-
|
|
include/grub/emu/getroot.h | 4 ++++
|
|
include/grub/emu/misc.h | 3 +++
|
|
include/grub/misc.h | 6 +++---
|
|
29 files changed, 57 insertions(+), 47 deletions(-)
|
|
|
|
diff --git a/grub-core/commands/date.c b/grub-core/commands/date.c
|
|
index 8e1f41f141b..0ff0f132c28 100644
|
|
--- a/grub-core/commands/date.c
|
|
+++ b/grub-core/commands/date.c
|
|
@@ -35,7 +35,7 @@ GRUB_MOD_LICENSE ("GPLv3+");
|
|
|
|
static grub_err_t
|
|
grub_cmd_date (grub_command_t cmd __attribute__ ((unused)),
|
|
- int argc, char **args)
|
|
+ int argc, char ** args)
|
|
{
|
|
struct grub_datetime datetime;
|
|
int limit[6][2] = {{1980, 2079}, {1, 12}, {1, 31}, {0, 23}, {0, 59}, {0, 59}};
|
|
@@ -59,7 +59,8 @@ grub_cmd_date (grub_command_t cmd __attribute__ ((unused)),
|
|
|
|
for (; argc; argc--, args++)
|
|
{
|
|
- char *p, c;
|
|
+ const char *p;
|
|
+ char c;
|
|
int m1, ofs, n, cur_mask;
|
|
|
|
p = args[0];
|
|
diff --git a/grub-core/commands/password_pbkdf2.c b/grub-core/commands/password_pbkdf2.c
|
|
index da636e6217a..ab845d25eb3 100644
|
|
--- a/grub-core/commands/password_pbkdf2.c
|
|
+++ b/grub-core/commands/password_pbkdf2.c
|
|
@@ -86,7 +86,7 @@ grub_cmd_password (grub_command_t cmd __attribute__ ((unused)),
|
|
int argc, char **args)
|
|
{
|
|
grub_err_t err;
|
|
- char *ptr, *ptr2;
|
|
+ const char *ptr, *ptr2;
|
|
grub_uint8_t *ptro;
|
|
struct pbkdf2_password *pass;
|
|
|
|
diff --git a/grub-core/commands/regexp.c b/grub-core/commands/regexp.c
|
|
index f00b184c81e..7c5c72fe460 100644
|
|
--- a/grub-core/commands/regexp.c
|
|
+++ b/grub-core/commands/regexp.c
|
|
@@ -64,7 +64,7 @@ set_matches (char **varnames, char *str, grub_size_t nmatches,
|
|
{
|
|
int i;
|
|
char *p;
|
|
- char *q;
|
|
+ const char * q;
|
|
grub_err_t err;
|
|
unsigned long j;
|
|
|
|
diff --git a/grub-core/commands/videoinfo.c b/grub-core/commands/videoinfo.c
|
|
index 4be8107d553..016a4d81835 100644
|
|
--- a/grub-core/commands/videoinfo.c
|
|
+++ b/grub-core/commands/videoinfo.c
|
|
@@ -136,7 +136,7 @@ grub_cmd_videoinfo (grub_command_t cmd __attribute__ ((unused)),
|
|
ctx.height = ctx.width = ctx.depth = 0;
|
|
if (argc)
|
|
{
|
|
- char *ptr;
|
|
+ const char *ptr;
|
|
ptr = args[0];
|
|
ctx.width = grub_strtoul (ptr, &ptr, 0);
|
|
if (grub_errno)
|
|
diff --git a/grub-core/disk/diskfilter.c b/grub-core/disk/diskfilter.c
|
|
index 66f6b992604..5447e04e702 100644
|
|
--- a/grub-core/disk/diskfilter.c
|
|
+++ b/grub-core/disk/diskfilter.c
|
|
@@ -971,7 +971,8 @@ grub_diskfilter_vg_register (struct grub_diskfilter_vg *vg)
|
|
for (p = vgp->lvs; p; p = p->next)
|
|
{
|
|
int cur_num;
|
|
- char *num, *end;
|
|
+ char *num;
|
|
+ const char *end;
|
|
if (!p->fullname)
|
|
continue;
|
|
if (grub_strncmp (p->fullname, lv->fullname, len) != 0)
|
|
diff --git a/grub-core/disk/lvm.c b/grub-core/disk/lvm.c
|
|
index 7b265c780c3..0cbd0dd1629 100644
|
|
--- a/grub-core/disk/lvm.c
|
|
+++ b/grub-core/disk/lvm.c
|
|
@@ -38,7 +38,7 @@ GRUB_MOD_LICENSE ("GPLv3+");
|
|
at the number. In case STR is not found, *P will be NULL and the
|
|
return value will be 0. */
|
|
static grub_uint64_t
|
|
-grub_lvm_getvalue (char **p, const char *str)
|
|
+grub_lvm_getvalue (const char ** const p, const char *str)
|
|
{
|
|
*p = grub_strstr (*p, str);
|
|
if (! *p)
|
|
@@ -63,12 +63,12 @@ grub_lvm_checkvalue (char **p, char *str, char *tmpl)
|
|
#endif
|
|
|
|
static int
|
|
-grub_lvm_check_flag (char *p, const char *str, const char *flag)
|
|
+grub_lvm_check_flag (const char *p, const char *str, const char *flag)
|
|
{
|
|
grub_size_t len_str = grub_strlen (str), len_flag = grub_strlen (flag);
|
|
while (1)
|
|
{
|
|
- char *q;
|
|
+ const char *q;
|
|
p = grub_strstr (p, str);
|
|
if (! p)
|
|
return 0;
|
|
@@ -105,7 +105,8 @@ grub_lvm_detect (grub_disk_t disk,
|
|
char buf[GRUB_LVM_LABEL_SIZE];
|
|
char vg_id[GRUB_LVM_ID_STRLEN+1];
|
|
char pv_id[GRUB_LVM_ID_STRLEN+1];
|
|
- char *metadatabuf, *p, *q, *vgname;
|
|
+ char *metadatabuf, *vgname;
|
|
+ const char *p, *q;
|
|
struct grub_lvm_label_header *lh = (struct grub_lvm_label_header *) buf;
|
|
struct grub_lvm_pv_header *pvh;
|
|
struct grub_lvm_disk_locn *dlocn;
|
|
diff --git a/grub-core/kern/fs.c b/grub-core/kern/fs.c
|
|
index 9085895b6fe..1bd748be83b 100644
|
|
--- a/grub-core/kern/fs.c
|
|
+++ b/grub-core/kern/fs.c
|
|
@@ -134,7 +134,7 @@ struct grub_fs_block
|
|
static grub_err_t
|
|
grub_fs_blocklist_open (grub_file_t file, const char *name)
|
|
{
|
|
- char *p = (char *) name;
|
|
+ const char *p = name;
|
|
unsigned num = 0;
|
|
unsigned i;
|
|
grub_disk_t disk = file->device->disk;
|
|
diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c
|
|
index 5c3899f0e5b..aaae9aa0ab7 100644
|
|
--- a/grub-core/kern/misc.c
|
|
+++ b/grub-core/kern/misc.c
|
|
@@ -383,7 +383,7 @@ grub_isspace (int c)
|
|
}
|
|
|
|
unsigned long
|
|
-grub_strtoul (const char *str, char **end, int base)
|
|
+grub_strtoul (const char *str, const char ** const end, int base)
|
|
{
|
|
unsigned long long num;
|
|
|
|
@@ -400,7 +400,7 @@ grub_strtoul (const char *str, char **end, int base)
|
|
}
|
|
|
|
unsigned long long
|
|
-grub_strtoull (const char *str, char **end, int base)
|
|
+grub_strtoull (const char *str, const char ** const end, int base)
|
|
{
|
|
unsigned long long num = 0;
|
|
int found = 0;
|
|
@@ -901,14 +901,14 @@ grub_vsnprintf_real (char *str, grub_size_t max_len, const char *fmt0,
|
|
{
|
|
if (fmt[0] == '0')
|
|
zerofill = '0';
|
|
- format1 = grub_strtoul (fmt, (char **) &fmt, 10);
|
|
+ format1 = grub_strtoul (fmt, &fmt, 10);
|
|
}
|
|
|
|
if (*fmt == '.')
|
|
fmt++;
|
|
|
|
if (grub_isdigit (*fmt))
|
|
- format2 = grub_strtoul (fmt, (char **) &fmt, 10);
|
|
+ format2 = grub_strtoul (fmt, &fmt, 10);
|
|
|
|
if (*fmt == '$')
|
|
{
|
|
diff --git a/grub-core/kern/partition.c b/grub-core/kern/partition.c
|
|
index e499147cbcb..2c401b866c4 100644
|
|
--- a/grub-core/kern/partition.c
|
|
+++ b/grub-core/kern/partition.c
|
|
@@ -126,7 +126,7 @@ grub_partition_probe (struct grub_disk *disk, const char *str)
|
|
while (*ptr && grub_isalpha (*ptr))
|
|
ptr++;
|
|
partname_end = ptr;
|
|
- num = grub_strtoul (ptr, (char **) &ptr, 0) - 1;
|
|
+ num = grub_strtoul (ptr, &ptr, 0) - 1;
|
|
|
|
curpart = 0;
|
|
/* Use the first partition map type found. */
|
|
diff --git a/grub-core/lib/arg.c b/grub-core/lib/arg.c
|
|
index fd7744a6ff6..ccc185017ee 100644
|
|
--- a/grub-core/lib/arg.c
|
|
+++ b/grub-core/lib/arg.c
|
|
@@ -375,7 +375,7 @@ grub_arg_parse (grub_extcmd_t cmd, int argc, char **argv,
|
|
|
|
case ARG_TYPE_INT:
|
|
{
|
|
- char *tail;
|
|
+ const char * tail;
|
|
|
|
grub_strtoull (option, &tail, 0);
|
|
if (tail == 0 || tail == option || *tail != '\0' || grub_errno)
|
|
diff --git a/grub-core/lib/legacy_parse.c b/grub-core/lib/legacy_parse.c
|
|
index ef56150ac77..05719ab2ccb 100644
|
|
--- a/grub-core/lib/legacy_parse.c
|
|
+++ b/grub-core/lib/legacy_parse.c
|
|
@@ -418,7 +418,7 @@ adjust_file (const char *in, grub_size_t len)
|
|
}
|
|
if (*comma != ',')
|
|
return grub_legacy_escape (in, len);
|
|
- part = grub_strtoull (comma + 1, (char **) &rest, 0);
|
|
+ part = grub_strtoull (comma + 1, &rest, 0);
|
|
if (rest[0] == ',' && rest[1] >= 'a' && rest[1] <= 'z')
|
|
{
|
|
subpart = rest[1] - 'a';
|
|
diff --git a/grub-core/lib/syslinux_parse.c b/grub-core/lib/syslinux_parse.c
|
|
index 28ba3aef0bb..21ca040ada7 100644
|
|
--- a/grub-core/lib/syslinux_parse.c
|
|
+++ b/grub-core/lib/syslinux_parse.c
|
|
@@ -1058,7 +1058,7 @@ write_entry (struct output_buffer *outbuf,
|
|
if (ptr[0] == 'h' && ptr[1] == 'd')
|
|
{
|
|
is_fd = 0;
|
|
- devn = grub_strtoul (ptr + 2, &ptr, 0);
|
|
+ devn = grub_strtoul (ptr + 2, (const char **)&ptr, 0);
|
|
continue;
|
|
}
|
|
if (grub_strncasecmp (ptr, "file=", 5) == 0)
|
|
@@ -1082,12 +1082,12 @@ write_entry (struct output_buffer *outbuf,
|
|
if (ptr[0] == 'f' && ptr[1] == 'd')
|
|
{
|
|
is_fd = 1;
|
|
- devn = grub_strtoul (ptr + 2, &ptr, 0);
|
|
+ devn = grub_strtoul (ptr + 2, (const char **)&ptr, 0);
|
|
continue;
|
|
}
|
|
if (grub_isdigit (ptr[0]))
|
|
{
|
|
- part = grub_strtoul (ptr, &ptr, 0);
|
|
+ part = grub_strtoul (ptr, (const char **)&ptr, 0);
|
|
continue;
|
|
}
|
|
/* FIXME: isolinux, ntldr, cmldr, *dos, seg, hide
|
|
diff --git a/grub-core/loader/i386/xen_fileXX.c b/grub-core/loader/i386/xen_fileXX.c
|
|
index fb66e66fe96..293f1ad5c3e 100644
|
|
--- a/grub-core/loader/i386/xen_fileXX.c
|
|
+++ b/grub-core/loader/i386/xen_fileXX.c
|
|
@@ -25,7 +25,7 @@ parse_xen_guest (grub_elf_t elf, struct grub_xen_file_info *xi,
|
|
grub_off_t off, grub_size_t sz)
|
|
{
|
|
char *buf;
|
|
- char *ptr;
|
|
+ const char *ptr;
|
|
int has_paddr = 0;
|
|
|
|
grub_errno = GRUB_ERR_NONE;
|
|
diff --git a/grub-core/net/efi/ip4_config.c b/grub-core/net/efi/ip4_config.c
|
|
index b711a5d9457..38e2a04747a 100644
|
|
--- a/grub-core/net/efi/ip4_config.c
|
|
+++ b/grub-core/net/efi/ip4_config.c
|
|
@@ -62,7 +62,7 @@ grub_efi_string_to_ip4_address (const char *val, grub_efi_ipv4_address_t *addres
|
|
for (i = 0; i < 4; i++)
|
|
{
|
|
unsigned long t;
|
|
- t = grub_strtoul (ptr, (char **) &ptr, 0);
|
|
+ t = grub_strtoul (ptr, &ptr, 0);
|
|
if (grub_errno)
|
|
{
|
|
grub_errno = GRUB_ERR_NONE;
|
|
diff --git a/grub-core/net/efi/ip6_config.c b/grub-core/net/efi/ip6_config.c
|
|
index 017c4d05bc7..e0e00c23d21 100644
|
|
--- a/grub-core/net/efi/ip6_config.c
|
|
+++ b/grub-core/net/efi/ip6_config.c
|
|
@@ -84,7 +84,7 @@ grub_efi_string_to_ip6_address (const char *val, grub_efi_ipv6_address_t *addres
|
|
ptr++;
|
|
continue;
|
|
}
|
|
- t = grub_strtoul (ptr, (char **) &ptr, 16);
|
|
+ t = grub_strtoul (ptr, &ptr, 16);
|
|
if (grub_errno)
|
|
{
|
|
grub_errno = GRUB_ERR_NONE;
|
|
diff --git a/grub-core/net/efi/net.c b/grub-core/net/efi/net.c
|
|
index f208d1b180c..4c70fc4da2a 100644
|
|
--- a/grub-core/net/efi/net.c
|
|
+++ b/grub-core/net/efi/net.c
|
|
@@ -729,7 +729,7 @@ grub_efi_net_parse_address (const char *address,
|
|
{
|
|
grub_uint32_t subnet_mask_size;
|
|
|
|
- subnet_mask_size = grub_strtoul (rest + 1, (char **) &rest, 0);
|
|
+ subnet_mask_size = grub_strtoul (rest + 1, &rest, 0);
|
|
|
|
if (!grub_errno && subnet_mask_size <= 32 && *rest == 0)
|
|
{
|
|
@@ -758,7 +758,7 @@ grub_efi_net_parse_address (const char *address,
|
|
{
|
|
grub_efi_uint8_t prefix_length;
|
|
|
|
- prefix_length = grub_strtoul (rest + 1, (char **) &rest, 0);
|
|
+ prefix_length = grub_strtoul (rest + 1, &rest, 0);
|
|
if (!grub_errno && prefix_length <= 128 && *rest == 0)
|
|
{
|
|
ip6->prefix_length = prefix_length;
|
|
diff --git a/grub-core/net/efi/pxe.c b/grub-core/net/efi/pxe.c
|
|
index 531949cba5c..73e2bb01c1b 100644
|
|
--- a/grub-core/net/efi/pxe.c
|
|
+++ b/grub-core/net/efi/pxe.c
|
|
@@ -187,7 +187,7 @@ parse_ip6 (const char *val, grub_uint64_t *ip, const char **rest)
|
|
ptr++;
|
|
continue;
|
|
}
|
|
- t = grub_strtoul (ptr, (char **) &ptr, 16);
|
|
+ t = grub_strtoul (ptr, &ptr, 16);
|
|
if (grub_errno)
|
|
{
|
|
grub_errno = GRUB_ERR_NONE;
|
|
@@ -225,7 +225,7 @@ pxe_open (struct grub_efi_net_device *dev,
|
|
int type __attribute__((unused)))
|
|
{
|
|
int i;
|
|
- char *p;
|
|
+ const char *p;
|
|
grub_efi_status_t status;
|
|
grub_efi_pxe_ip_address_t server_ip;
|
|
grub_efi_uint64_t file_size = 0;
|
|
@@ -313,7 +313,7 @@ pxe_read (struct grub_efi_net_device *dev,
|
|
grub_size_t len)
|
|
{
|
|
int i;
|
|
- char *p;
|
|
+ const char *p;
|
|
grub_efi_status_t status;
|
|
grub_efi_pxe_t *pxe = (prefer_ip6) ? dev->ip6_pxe : dev->ip4_pxe;
|
|
grub_efi_uint64_t bufsz = len;
|
|
diff --git a/grub-core/net/http.c b/grub-core/net/http.c
|
|
index c9c59690a98..b52b558d631 100644
|
|
--- a/grub-core/net/http.c
|
|
+++ b/grub-core/net/http.c
|
|
@@ -110,7 +110,7 @@ parse_line (grub_file_t file, http_data_t data, char *ptr, grub_size_t len)
|
|
return GRUB_ERR_NONE;
|
|
}
|
|
ptr += sizeof ("HTTP/1.1 ") - 1;
|
|
- code = grub_strtoul (ptr, &ptr, 10);
|
|
+ code = grub_strtoul (ptr, (const char **)&ptr, 10);
|
|
if (grub_errno)
|
|
return grub_errno;
|
|
switch (code)
|
|
@@ -137,7 +137,7 @@ parse_line (grub_file_t file, http_data_t data, char *ptr, grub_size_t len)
|
|
== 0 && !data->size_recv)
|
|
{
|
|
ptr += sizeof ("Content-Length: ") - 1;
|
|
- file->size = grub_strtoull (ptr, &ptr, 10);
|
|
+ file->size = grub_strtoull (ptr, (const char **)&ptr, 10);
|
|
data->size_recv = 1;
|
|
return GRUB_ERR_NONE;
|
|
}
|
|
diff --git a/grub-core/net/net.c b/grub-core/net/net.c
|
|
index a571ee92efa..a011b940100 100644
|
|
--- a/grub-core/net/net.c
|
|
+++ b/grub-core/net/net.c
|
|
@@ -411,7 +411,7 @@ parse_ip (const char *val, grub_uint32_t *ip, const char **rest)
|
|
for (i = 0; i < 4; i++)
|
|
{
|
|
unsigned long t;
|
|
- t = grub_strtoul (ptr, (char **) &ptr, 0);
|
|
+ t = grub_strtoul (ptr, &ptr, 0);
|
|
if (grub_errno)
|
|
{
|
|
grub_errno = GRUB_ERR_NONE;
|
|
@@ -465,7 +465,7 @@ parse_ip6 (const char *val, grub_uint64_t *ip, const char **rest)
|
|
ptr++;
|
|
continue;
|
|
}
|
|
- t = grub_strtoul (ptr, (char **) &ptr, 16);
|
|
+ t = grub_strtoul (ptr, &ptr, 16);
|
|
if (grub_errno)
|
|
{
|
|
grub_errno = GRUB_ERR_NONE;
|
|
@@ -577,7 +577,7 @@ grub_net_resolve_net_address (const char *name,
|
|
addr->type = GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV4;
|
|
if (*rest == '/')
|
|
{
|
|
- addr->ipv4.masksize = grub_strtoul (rest + 1, (char **) &rest, 0);
|
|
+ addr->ipv4.masksize = grub_strtoul (rest + 1, &rest, 0);
|
|
if (!grub_errno && *rest == 0)
|
|
return GRUB_ERR_NONE;
|
|
grub_errno = GRUB_ERR_NONE;
|
|
@@ -593,7 +593,7 @@ grub_net_resolve_net_address (const char *name,
|
|
addr->type = GRUB_NET_NETWORK_LEVEL_PROTOCOL_IPV6;
|
|
if (*rest == '/')
|
|
{
|
|
- addr->ipv6.masksize = grub_strtoul (rest + 1, (char **) &rest, 0);
|
|
+ addr->ipv6.masksize = grub_strtoul (rest + 1, &rest, 0);
|
|
if (!grub_errno && *rest == 0)
|
|
return GRUB_ERR_NONE;
|
|
grub_errno = GRUB_ERR_NONE;
|
|
diff --git a/grub-core/net/url.c b/grub-core/net/url.c
|
|
index 146858284cd..d9d2fc9a9dc 100644
|
|
--- a/grub-core/net/url.c
|
|
+++ b/grub-core/net/url.c
|
|
@@ -235,7 +235,7 @@ extract_http_url_info (char *url, int ssl,
|
|
c = *port_end;
|
|
*port_end = '\0';
|
|
|
|
- portul = grub_strtoul (port_off, &separator, 10);
|
|
+ portul = grub_strtoul (port_off, (const char **)&separator, 10);
|
|
*port_end = c;
|
|
#ifdef URL_TEST
|
|
if (portul == ULONG_MAX && errno == ERANGE)
|
|
diff --git a/grub-core/osdep/devmapper/hostdisk.c b/grub-core/osdep/devmapper/hostdisk.c
|
|
index a697bcb4d8d..a8afc0c9408 100644
|
|
--- a/grub-core/osdep/devmapper/hostdisk.c
|
|
+++ b/grub-core/osdep/devmapper/hostdisk.c
|
|
@@ -113,7 +113,7 @@ grub_util_get_dm_node_linear_info (dev_t dev,
|
|
void *next = NULL;
|
|
uint64_t length, start;
|
|
char *target, *params;
|
|
- char *ptr;
|
|
+ const char *ptr;
|
|
int major = 0, minor = 0;
|
|
int first = 1;
|
|
grub_disk_addr_t partstart = 0;
|
|
diff --git a/grub-core/script/execute.c b/grub-core/script/execute.c
|
|
index 93965777138..7d327f59d92 100644
|
|
--- a/grub-core/script/execute.c
|
|
+++ b/grub-core/script/execute.c
|
|
@@ -146,7 +146,7 @@ replace_scope (struct grub_script_scope *new_scope)
|
|
grub_err_t
|
|
grub_script_break (grub_command_t cmd, int argc, char *argv[])
|
|
{
|
|
- char *p = 0;
|
|
+ const char *p = NULL;
|
|
unsigned long count;
|
|
|
|
if (argc == 0)
|
|
@@ -178,7 +178,7 @@ grub_err_t
|
|
grub_script_shift (grub_command_t cmd __attribute__((unused)),
|
|
int argc, char *argv[])
|
|
{
|
|
- char *p = 0;
|
|
+ const char *p = NULL;
|
|
unsigned long n = 0;
|
|
|
|
if (! scope)
|
|
@@ -239,7 +239,7 @@ grub_err_t
|
|
grub_script_return (grub_command_t cmd __attribute__((unused)),
|
|
int argc, char *argv[])
|
|
{
|
|
- char *p;
|
|
+ const char *p = NULL;
|
|
unsigned long n;
|
|
|
|
if (! scope || argc > 1)
|
|
diff --git a/grub-core/term/serial.c b/grub-core/term/serial.c
|
|
index db80b3ba0fb..f9271b09239 100644
|
|
--- a/grub-core/term/serial.c
|
|
+++ b/grub-core/term/serial.c
|
|
@@ -269,7 +269,7 @@ grub_cmd_serial (grub_extcmd_context_t ctxt, int argc, char **args)
|
|
|
|
if (state[OPTION_BASE_CLOCK].set)
|
|
{
|
|
- char *ptr;
|
|
+ const char *ptr;
|
|
config.base_clock = grub_strtoull (state[OPTION_BASE_CLOCK].arg, &ptr, 0);
|
|
if (grub_errno)
|
|
return grub_errno;
|
|
diff --git a/grub-core/term/terminfo.c b/grub-core/term/terminfo.c
|
|
index 29df35e6d20..537a5c0cb0b 100644
|
|
--- a/grub-core/term/terminfo.c
|
|
+++ b/grub-core/term/terminfo.c
|
|
@@ -737,7 +737,7 @@ grub_cmd_terminfo (grub_extcmd_context_t ctxt, int argc, char **args)
|
|
|
|
if (state[OPTION_GEOMETRY].set)
|
|
{
|
|
- char *ptr = state[OPTION_GEOMETRY].arg;
|
|
+ const char *ptr = state[OPTION_GEOMETRY].arg;
|
|
w = grub_strtoul (ptr, &ptr, 0);
|
|
if (grub_errno)
|
|
return grub_errno;
|
|
diff --git a/grub-core/tests/strtoull_test.c b/grub-core/tests/strtoull_test.c
|
|
index 7da615ff33e..5488ab26b43 100644
|
|
--- a/grub-core/tests/strtoull_test.c
|
|
+++ b/grub-core/tests/strtoull_test.c
|
|
@@ -25,7 +25,7 @@ static void
|
|
strtoull_testcase (const char *input, int base, unsigned long long expected,
|
|
int num_digits, grub_err_t error)
|
|
{
|
|
- char *output;
|
|
+ const char *output;
|
|
unsigned long long value;
|
|
grub_errno = 0;
|
|
value = grub_strtoull(input, &output, base);
|
|
diff --git a/util/grub-fstest.c b/util/grub-fstest.c
|
|
index f82f9504054..5095fa8356c 100644
|
|
--- a/util/grub-fstest.c
|
|
+++ b/util/grub-fstest.c
|
|
@@ -538,7 +538,7 @@ void (*argp_program_version_hook) (FILE *, struct argp_state *) = print_version;
|
|
static error_t
|
|
argp_parser (int key, char *arg, struct argp_state *state)
|
|
{
|
|
- char *p;
|
|
+ const char *p;
|
|
|
|
switch (key)
|
|
{
|
|
diff --git a/include/grub/emu/getroot.h b/include/grub/emu/getroot.h
|
|
index 9c642ae3fe3..80b96b972d0 100644
|
|
--- a/include/grub/emu/getroot.h
|
|
+++ b/include/grub/emu/getroot.h
|
|
@@ -19,6 +19,8 @@
|
|
#ifndef GRUB_UTIL_GETROOT_HEADER
|
|
#define GRUB_UTIL_GETROOT_HEADER 1
|
|
|
|
+#define NEED_GRUB_MAKE_SYSTEM_PATH_RELATIVE
|
|
+
|
|
#include <grub/types.h>
|
|
#include <grub/device.h>
|
|
|
|
@@ -37,7 +39,9 @@ char *grub_find_device (const char *dir, dev_t dev);
|
|
void grub_util_pull_device (const char *osname);
|
|
char **grub_guess_root_devices (const char *dir);
|
|
int grub_util_get_dev_abstraction (const char *os_dev);
|
|
+#ifndef NEED_GRUB_MAKE_SYSTEM_PATH_RELATIVE
|
|
char *grub_make_system_path_relative_to_its_root (const char *path);
|
|
+#endif
|
|
char *
|
|
grub_make_system_path_relative_to_its_root_os (const char *path);
|
|
char *grub_util_get_grub_dev (const char *os_dev);
|
|
diff --git a/include/grub/emu/misc.h b/include/grub/emu/misc.h
|
|
index a653132e36a..1ca4c78de97 100644
|
|
--- a/include/grub/emu/misc.h
|
|
+++ b/include/grub/emu/misc.h
|
|
@@ -40,6 +40,9 @@ void grub_find_zpool_from_dir (const char *dir,
|
|
|
|
char *grub_make_system_path_relative_to_its_root (const char *path)
|
|
WARN_UNUSED_RESULT;
|
|
+#ifdef NEED_GRUB_MAKE_SYSTEM_PATH_RELATIVE
|
|
+#undef NEED_GRUB_MAKE_SYSTEM_PATH_RELATIVE
|
|
+#endif
|
|
int
|
|
grub_util_device_is_mapped (const char *dev);
|
|
|
|
diff --git a/include/grub/misc.h b/include/grub/misc.h
|
|
index de9016ab709..1258ec6bbf3 100644
|
|
--- a/include/grub/misc.h
|
|
+++ b/include/grub/misc.h
|
|
@@ -288,11 +288,11 @@ grub_strncasecmp (const char *s1, const char *s2, grub_size_t n)
|
|
- (int) grub_tolower ((grub_uint8_t) *s2);
|
|
}
|
|
|
|
-unsigned long EXPORT_FUNC(grub_strtoul) (const char *str, char **end, int base);
|
|
-unsigned long long EXPORT_FUNC(grub_strtoull) (const char *str, char **end, int base);
|
|
+unsigned long EXPORT_FUNC(grub_strtoul) (const char *str, const char ** const end, int base);
|
|
+unsigned long long EXPORT_FUNC(grub_strtoull) (const char *str, const char ** const end, int base);
|
|
|
|
static inline long
|
|
-grub_strtol (const char *str, char **end, int base)
|
|
+grub_strtol (const char *str, const char ** const end, int base)
|
|
{
|
|
int negative = 0;
|
|
unsigned long long magnitude;
|