Package: bwm-ng
Version: 0.6-3
Severity: normal
Tags: patch
User: [EMAIL PROTECTED]
Usertags: origin-ubuntu jaunty ubuntu-patch
In Ubuntu the gcc is set to make some more rigorous checks of the
source code and report warnings for these common issues. Lots of
packages are affected, but yours more so than most as it caused it
to fail to build seemingly due to a gcc bug. You can see the log
at
http://launchpadlibrarian.net/19638343/buildlog_ubuntu-jaunty-i386.bwm-ng_0.6-3_FAILEDTOBUILD.txt.gz
While that's not really of interest to you it prompted me to try
and patch the problems out of the package, so I am sending that
patch to you.
While this is an issue with the Ubuntu toolchain the extra checks
are there for a reason, to catch common problems such as these.
Please consider applying the attached patch.
Thanks,
James
--- bwm-ng-0.6.orig/src/output.c
+++ bwm-ng-0.6/src/output.c
@@ -223,8 +223,8 @@
fprintf(tmp_out_file,"<title>bwm-ng stats</title>\n</head>\n<body>\n");
}
fprintf(tmp_out_file,"<div class=\"bwm-ng-header\">bwm-ng bwm-ng v" VERSION " (refresh %is); input: ",html_refresh);
- fprintf(tmp_out_file,input2str());
- fprintf(tmp_out_file,show_all_if2str());
+ fprintf(tmp_out_file,"%s", input2str());
+ fprintf(tmp_out_file,"%s", show_all_if2str());
fprintf(tmp_out_file,"</div><table class=\"bwm-ng-output\">");
fprintf(tmp_out_file,"<tr class=\"bwm-ng-head\"><td class=\"bwm-ng-name\">Interface</td><td>Rx</td><td>Tx</td><td>Total</td></tr>");
break;
@@ -234,7 +234,7 @@
if (output_method==PLAIN_OUT && ansi_output) printf("\033[1;2H");
printf("bwm-ng v" VERSION " (delay %2.3fs); ",(float)delay/1000);
if (output_method==PLAIN_OUT) printf("press 'ctrl-c' to end this%s",(ansi_output ? "\033[2;2H" : "")); else printf("input: ");
- printf(input2str());
+ printf("%s", input2str());
printf("%s\n",show_all_if2str());
if (output_method==PLAIN_OUT) {
if (ansi_output)
only in patch2:
unchanged:
--- bwm-ng-0.6.orig/src/input/proc_diskstats.c
+++ bwm-ng-0.6/src/input/proc_diskstats.c
@@ -85,8 +85,14 @@
diskstats_works = 1;
} else {
/* skip first two lines in /proc/partitions */
- fgets(buffer,MAX_LINE_BUFFER,f);
- fgets(buffer,MAX_LINE_BUFFER,f);
+ if (fgets(buffer,MAX_LINE_BUFFER,f) &&
+ fgets(buffer,MAX_LINE_BUFFER,f)) {
+ /* read correctly */
+ ;
+ } else {
+ /* error or EOF while reading file, either way we can't continue */
+ deinit(1, "reading %s failed, or file was too short: %s\n", PROC_PARTITIONS_FILE, strerror(errno));
+ }
}
}