From: Gene Cumm <gene.cumm at gmail.com> Fix several calls to more_printf() as eventually printf() is called without a literal string which generate warnings with gcc and lead to errors when -Werror is active. Signed-off-by: Gene Cumm <gene.cumm at gmail.com> The message "format not a string literal and no format arguments" at first seems strange but by doing this change it forces printf to print exactly what is in the string variable without attempting to re-interpret for another argument (just in case there's a '%' in the string). --- diff --git a/com32/hdt/hdt-cli-cpu.c b/com32/hdt/hdt-cli-cpu.c index aa7ec8f..1695ccd 100644 --- a/com32/hdt/hdt-cli-cpu.c +++ b/com32/hdt/hdt-cli-cpu.c @@ -67,7 +67,7 @@ static void show_flag(char *buffer, bool flag, char *flag_name, bool flush) if ((((strlen(buffer) + strlen(flag_name)) > 66) && flag) || flush) { snprintf(output_buffer, sizeof output_buffer, "Flags : %s\n", buffer); - more_printf(output_buffer); + more_printf("%s", output_buffer); memset(buffer, 0, sizeof(buffer)); if (flush) return; diff --git a/com32/hdt/hdt-cli-kernel.c b/com32/hdt/hdt-cli-kernel.c index d4946f3..f64771b 100644 --- a/com32/hdt/hdt-cli-kernel.c +++ b/com32/hdt/hdt-cli-kernel.c @@ -83,7 +83,7 @@ void main_show_kernel(int argc __unused, char **argv __unused, } if (found == true) { strncat(buffer, "\n", 1); - more_printf(buffer); + more_printf("%s", buffer); } } diff --git a/com32/hdt/hdt-cli-pci.c b/com32/hdt/hdt-cli-pci.c index c86a792..e0b7830 100644 --- a/com32/hdt/hdt-cli-pci.c +++ b/com32/hdt/hdt-cli-pci.c @@ -206,8 +206,8 @@ static void show_pci_devices(int argc __unused, char **argv __unused, pci_device->product, pci_device->sub_vendor, pci_device->sub_product); - more_printf(first_line); - more_printf(second_line); + more_printf("%s", first_line); + more_printf("%s", second_line); more_printf("\n"); } else if (nopciids == true) { if (nomodulesfile == true) { diff --git a/com32/hdt/hdt-cli-pxe.c b/com32/hdt/hdt-cli-pxe.c index 3a61bc0..29e760a 100644 --- a/com32/hdt/hdt-cli-pxe.c +++ b/com32/hdt/hdt-cli-pxe.c @@ -66,14 +66,14 @@ void main_show_pxe(int argc __unused, char **argv __unused, snprintf(buffer, sizeof(buffer), " PCI Bus pos. : %02x:%02x.%02x\n", p->pci_bus, p->pci_dev, p->pci_func); - more_printf(buffer); + more_printf("%s", buffer); } else { snprintf(buffer, sizeof(buffer), " Manufacturer : %s \n", p->pci_device->dev_info->vendor_name); - more_printf(buffer); + more_printf("%s", buffer); snprintf(buffer, sizeof(buffer), " Product : %s \n", p->pci_device->dev_info->product_name); - more_printf(buffer); + more_printf("%s", buffer); } more_printf(" Addresses : %d.%d.%d.%d @ %s\n", p->ip_addr[0], p->ip_addr[1], p->ip_addr[2], p->ip_addr[3], p->mac_addr);
--On Friday, June 18, 2010 06:43:48 PM -0400 Gene Cumm <gene.cumm at gmail.com> wrote:> From: Gene Cumm <gene.cumm at gmail.com> > > Fix several calls to more_printf() as eventually printf() is called > without a literal string which generate warnings with gcc and lead to > errors when -Werror is active. > > Signed-off-by: Gene Cumm <gene.cumm at gmail.com> > > The message "format not a string literal and no format arguments" at > first seems strange but by doing this change it forces printf to print > exactly what is in the string variable without attempting to > re-interpret for another argument (just in case there's a '%' in the > string).This is a good patch, but why not go a bit further...> snprintf(output_buffer, sizeof output_buffer, "Flags : %s\n", > buffer); > - more_printf(output_buffer); > + more_printf("%s", output_buffer);more_printf(Flags : %s\n", buffer);> if (found == true) { > strncat(buffer, "\n", 1); > - more_printf(buffer); > + more_printf("%s", buffer); > }more_printf("%s\n", buffer)> - more_printf(first_line); > - more_printf(second_line); > + more_printf("%s", first_line); > + more_printf("%s", second_line); > more_printf("\n");Good grief! more_printf("%s%s\n", first_line, second_line); ... and so on. -- Jeff
Peter, please pull from my contrib/master_new branch, it includes this fixes + some more of the same type. master_new is in sync with your current master. Thx for reporting. Erwan 2010/6/19 Gene Cumm <gene.cumm at gmail.com>:> From: Gene Cumm <gene.cumm at gmail.com> > > Fix several calls to more_printf() as eventually printf() is called > without a literal string which generate warnings with gcc and lead to > errors when -Werror is active. > > Signed-off-by: Gene Cumm <gene.cumm at gmail.com> > > The message "format not a string literal and no format arguments" at > first seems strange but by doing this change it forces printf to print > exactly what is in the string variable without attempting to > re-interpret for another argument (just in case there's a '%' in the > string). > > --- > > diff --git a/com32/hdt/hdt-cli-cpu.c b/com32/hdt/hdt-cli-cpu.c > index aa7ec8f..1695ccd 100644 > --- a/com32/hdt/hdt-cli-cpu.c > +++ b/com32/hdt/hdt-cli-cpu.c > @@ -67,7 +67,7 @@ static void show_flag(char *buffer, bool flag, char > *flag_name, bool flush) > ? ? if ((((strlen(buffer) + strlen(flag_name)) > 66) && flag) || flush) { > ? ? ? ?snprintf(output_buffer, sizeof output_buffer, "Flags ? ? : %s\n", > ? ? ? ? ? ? ? ? buffer); > - ? ? ? more_printf(output_buffer); > + ? ? ? more_printf("%s", output_buffer); > ? ? ? ?memset(buffer, 0, sizeof(buffer)); > ? ? ? ?if (flush) > ? ? ? ? ? ?return; > diff --git a/com32/hdt/hdt-cli-kernel.c b/com32/hdt/hdt-cli-kernel.c > index d4946f3..f64771b 100644 > --- a/com32/hdt/hdt-cli-kernel.c > +++ b/com32/hdt/hdt-cli-kernel.c > @@ -83,7 +83,7 @@ void main_show_kernel(int argc __unused, char **argv __unused, > ? ? } > ? ? if (found == true) { > ? ? ? ?strncat(buffer, "\n", 1); > - ? ? ? more_printf(buffer); > + ? ? ? more_printf("%s", buffer); > ? ? } > ?} > > diff --git a/com32/hdt/hdt-cli-pci.c b/com32/hdt/hdt-cli-pci.c > index c86a792..e0b7830 100644 > --- a/com32/hdt/hdt-cli-pci.c > +++ b/com32/hdt/hdt-cli-pci.c > @@ -206,8 +206,8 @@ static void show_pci_devices(int argc __unused, > char **argv __unused, > ? ? ? ? ? ? ? ? ? ? ? ? pci_device->product, > ? ? ? ? ? ? ? ? ? ? ? ? pci_device->sub_vendor, pci_device->sub_product); > > - ? ? ? ? ? more_printf(first_line); > - ? ? ? ? ? more_printf(second_line); > + ? ? ? ? ? more_printf("%s", first_line); > + ? ? ? ? ? more_printf("%s", second_line); > ? ? ? ? ? ?more_printf("\n"); > ? ? ? ?} else if (nopciids == true) { > ? ? ? ? ? ?if (nomodulesfile == true) { > diff --git a/com32/hdt/hdt-cli-pxe.c b/com32/hdt/hdt-cli-pxe.c > index 3a61bc0..29e760a 100644 > --- a/com32/hdt/hdt-cli-pxe.c > +++ b/com32/hdt/hdt-cli-pxe.c > @@ -66,14 +66,14 @@ void main_show_pxe(int argc __unused, char **argv __unused, > ? ? ? ?snprintf(buffer, sizeof(buffer), > ? ? ? ? ? ? ? ? " PCI Bus pos. : %02x:%02x.%02x\n", p->pci_bus, > ? ? ? ? ? ? ? ? p->pci_dev, p->pci_func); > - ? ? ? more_printf(buffer); > + ? ? ? more_printf("%s", buffer); > ? ? } else { > ? ? ? ?snprintf(buffer, sizeof(buffer), " Manufacturer : %s \n", > ? ? ? ? ? ? ? ? p->pci_device->dev_info->vendor_name); > - ? ? ? more_printf(buffer); > + ? ? ? more_printf("%s", buffer); > ? ? ? ?snprintf(buffer, sizeof(buffer), " Product ? ? ?: %s \n", > ? ? ? ? ? ? ? ? p->pci_device->dev_info->product_name); > - ? ? ? more_printf(buffer); > + ? ? ? more_printf("%s", buffer); > ? ? } > ? ? more_printf(" Addresses ? ?: %d.%d.%d.%d @ %s\n", p->ip_addr[0], > ? ? ? ? ? ? ? ?p->ip_addr[1], p->ip_addr[2], p->ip_addr[3], p->mac_addr); > > _______________________________________________ > Syslinux mailing list > Submissions to Syslinux at zytor.com > Unsubscribe or set options at: > http://www.zytor.com/mailman/listinfo/syslinux > Please do not send private replies to mailing list traffic. > >