On 1/3/2011 1:40 PM, Peter Huewe wrote:
> This patch fixes the warnings in devlist.cpp and process/do_process.cpp by
> adding the format string "%s" as second argument to sprintf

good change and good catch; will apply

thanks!

> Signed-off-by: Peter Huewe<[email protected]>
> ---
>   devlist.cpp            |    4 ++--
>   process/do_process.cpp |    6 +++---
>   2 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/devlist.cpp b/devlist.cpp
> index a29e0c6..ba483f7 100644
> --- a/devlist.cpp
> +++ b/devlist.cpp
> @@ -308,10 +308,10 @@ void html_show_open_devices(void)
>       for (i = 0; i<  target->size(); i++) {
>               proc[0] = 0;
>               if (strcmp(prev, (*target)[i]->comm) != 0)
> -                     sprintf(proc, (*target)[i]->comm);
> +                     sprintf(proc, "%s", (*target)[i]->comm);
>               fprintf(htmlout, "<tr 
> class=\"%s\"><td>%s</td><td>%s</td></tr>\n",
>                       dev_class(i), proc, (*target)[i]->device);
> -             sprintf(prev, (*target)[i]->comm);
> +             sprintf(prev, "%s", (*target)[i]->comm);
>       }
>
>       fprintf(htmlout, "</table>\n");
> diff --git a/process/do_process.cpp b/process/do_process.cpp
> index f15d081..382051e 100644
> --- a/process/do_process.cpp
> +++ b/process/do_process.cpp
> @@ -614,7 +614,7 @@ void process_update_display(void)
>
>               if (!show_power)
>                       strcpy(power, "          ");
> -             sprintf(name, all_power[i]->type());
> +             sprintf(name, "%s", all_power[i]->type());
>               while (mbstowcs(NULL,name,0)<  14) strcat(name, " ");
>
>
> @@ -686,7 +686,7 @@ void html_process_update_display(void)
>
>               if (!show_power)
>                       strcpy(power, "          ");
> -             sprintf(name, all_power[i]->type());
> +             sprintf(name, "%s", all_power[i]->type());
>
>               if (strcmp(name, "Device") == 0)
>                       continue;
> @@ -765,7 +765,7 @@ void html_summary(void)
>
>               if (!show_power)
>                       strcpy(power, "          ");
> -             sprintf(name, all_power[i]->type());
> +             sprintf(name, "%s", all_power[i]->type());
>
>               lines++;
>

_______________________________________________
Power mailing list
[email protected]
http://www.bughost.org/mailman/listinfo/power

Reply via email to