diff options
author | Tony Vroon <chainsaw@gentoo.org> | 2007-10-16 10:17:17 +0000 |
---|---|---|
committer | Tony Vroon <chainsaw@gentoo.org> | 2007-10-16 10:17:17 +0000 |
commit | a488e39fd3b069b9cdea9d59beabc4f561163432 (patch) | |
tree | 7424677452c097f48951ed72900dd4e84db068f2 /net-irc/xchat-xsys/files | |
parent | Stable on ppc64; bug #194812 (diff) | |
download | historical-a488e39fd3b069b9cdea9d59beabc4f561163432.tar.gz historical-a488e39fd3b069b9cdea9d59beabc4f561163432.tar.bz2 historical-a488e39fd3b069b9cdea9d59beabc4f561163432.zip |
Fix floating point exception with no swap mounted. Bug found and patched by Emopig <andrew@nelless.net>, closes bug #195966. Preemptively fix dependencies so the 2.1 branch will not be built against Audacious 1.4, this would fail.
Package-Manager: portage-2.1.3.13
Diffstat (limited to 'net-irc/xchat-xsys/files')
-rw-r--r-- | net-irc/xchat-xsys/files/2.1.0-fix-meminfo-swapoff.patch | 181 | ||||
-rw-r--r-- | net-irc/xchat-xsys/files/digest-xchat-xsys-2.1.0-r2 | 3 |
2 files changed, 184 insertions, 0 deletions
diff --git a/net-irc/xchat-xsys/files/2.1.0-fix-meminfo-swapoff.patch b/net-irc/xchat-xsys/files/2.1.0-fix-meminfo-swapoff.patch new file mode 100644 index 000000000000..f9cac399f1d9 --- /dev/null +++ b/net-irc/xchat-xsys/files/2.1.0-fix-meminfo-swapoff.patch @@ -0,0 +1,181 @@ +--- xsys.orig.c 2006-06-02 22:49:34.000000000 +0100 ++++ xsys.c 2007-10-15 18:46:10.000000000 +0100 +@@ -611,40 +611,157 @@ + return XCHAT_EAT_ALL; + } + ++ ++static unsigned int mem_sprint_stats ++( ++ const char* mem_type_name, ++ unsigned long long total_kb, ++ unsigned long long free_kb, ++ char* string_buffer, ++ int string_buffer_size ++) ++{ ++ char* str_i = string_buffer; ++ int str_buf_remaining = string_buffer_size; ++ ++ if ((string_buffer_size <= 0) || (!string_buffer) || (!mem_type_name)) ++ { ++ return 0; ++ } ++ ++ str_i = strncpy (str_i, mem_type_name, str_buf_remaining); ++ str_i += strlen (mem_type_name); ++ str_i = strncpy (str_i, " : ", str_buf_remaining); ++ str_i += 3; ++ ++ str_buf_remaining -= (str_i - string_buffer); ++ ++ if (total_kb >= 1048576) ++ { ++ if (percentages == 0) ++ { ++ str_i += snprintf ++ ( ++ str_i, ++ str_buf_remaining, ++ "%.1fGB/%.1fGB free", ++ (float) (free_kb / 1048576), ++ (float) (total_kb / 1048576) ++ ); ++ } ++ else ++ { ++ str_i += snprintf ++ ( ++ str_i, ++ str_buf_remaining, ++ "%.1fGB, %.1f%% free", ++ (float) (total_kb / 1048576), ++ percentage (&free_kb, &total_kb) ++ ); ++ } ++ } ++ else ++ { ++ if (percentages == 0) ++ { ++ str_i += snprintf ++ ( ++ str_i, ++ str_buf_remaining, ++ "%lldMB/%lldMB free", ++ (free_kb / 1024), ++ (total_kb / 1024) ++ ); ++ } ++ else ++ { ++ str_i += snprintf ++ ( ++ str_i, ++ str_buf_remaining, ++ "%lldMB, %.1f%% free", ++ (total_kb / 1024), ++ percentage (&free_kb, &total_kb) ++ ); ++ } ++ } ++ ++ str_buf_remaining = string_buffer_size - (str_i - string_buffer); ++ if (str_buf_remaining < 0) ++ { ++ // The string has been truncated and won't be NUL character ++ // terminated. This is unlikely but possible when using snprintf() ++ ++ string_buffer[string_buffer_size - 1] = '\0'; ++ return (string_buffer_size - 1); ++ } ++ ++ return (str_i - string_buffer); ++} ++ ++ + static int mem_cb(char *word[], char *word_eol[], void *userdata) + { +- unsigned long long mem_total, mem_free, swap_total, swap_free; +- char string[bsize]; ++ unsigned long long mem_total, mem_free, swap_total, swap_free; ++ char string[bsize]; ++ char* str_i = string; ++ int str_buf_remaining = sizeof(string); ++ + + if(xs_parse_meminfo(&mem_total, &mem_free, 0) == 1) + { + xchat_printf(ph, "ERROR in parse_meminfo!"); + return XCHAT_EAT_ALL; + } ++ + if(xs_parse_meminfo(&swap_total, &swap_free, 1) == 1) + { + xchat_printf(ph, "ERROR in parse_meminfo!"); + return XCHAT_EAT_ALL; + } +- +- if (percentages != 0) +- if (mem_total >= 1048576) +- snprintf(string, bsize, "Physical : %.1fGB, %.1f%% free | Swap : %.1fGB, %.1f%% free", +- (float)mem_total/1048576, percentage(&mem_free, &mem_total), (float)swap_total/1048576, +- percentage(&swap_free, &swap_total)); +- else +- snprintf(string, bsize, "Physical : %lldMB, %.1f%% free | Swap : %lldMB, %.1f%% free", +- mem_total/1024, percentage(&mem_free, &mem_total), swap_total/1024, +- percentage(&swap_free, &swap_total)); +- else +- if (mem_total >= 1048576) +- snprintf(string, bsize, "Physical : %.1fGB/%.1fGB Free | Swap : %.1fGB/%.1fGB Free", +- (float)mem_free/1048576, (float)mem_total/1048576, (float)swap_free/1048576, (float)swap_total/1048576); +- else +- snprintf(string, bsize, "Physical : %lldMB/%lldMB Free | Swap : %lldMB/%lldMB Free", +- mem_free/1024, mem_total/1024, swap_free/1024, swap_total/1024); +- +- format_output("mem", string, format); ++ ++ if (mem_total != 0) ++ { ++ str_i += mem_sprint_stats ++ ( ++ "Physical", ++ mem_total, ++ mem_free, ++ str_i, ++ str_buf_remaining ++ ); ++ ++ str_buf_remaining -= (str_i - string); ++ } ++ ++ str_i = strncpy (str_i, " | ", str_buf_remaining); ++ str_i += 3; ++ str_buf_remaining -= 3; ++ ++ if (swap_total == 0) ++ { ++ const char no_swap[] = "Swap : None mounted"; ++ ++ str_i = strncpy (str_i, no_swap, str_buf_remaining); ++ str_i += (sizeof (no_swap) - 1); ++ str_buf_remaining -= (sizeof (no_swap) - 1); ++ } ++ else ++ { ++ str_i += mem_sprint_stats ++ ( ++ "Swap", ++ swap_total, ++ swap_free, ++ str_i, ++ str_buf_remaining ++ ); ++ ++ str_buf_remaining -= (str_i - string); ++ } ++ ++ format_output ("mem", string, format); + + if((long)userdata) + xchat_printf(ph, "%s", string); diff --git a/net-irc/xchat-xsys/files/digest-xchat-xsys-2.1.0-r2 b/net-irc/xchat-xsys/files/digest-xchat-xsys-2.1.0-r2 new file mode 100644 index 000000000000..a8764842ccab --- /dev/null +++ b/net-irc/xchat-xsys/files/digest-xchat-xsys-2.1.0-r2 @@ -0,0 +1,3 @@ +MD5 fd4d97152422341b5ce81469481d10a8 xsys-2.1.0.tar.bz2 16499 +RMD160 cca47892379b0022d306370a93e35b0a0c8dfbd8 xsys-2.1.0.tar.bz2 16499 +SHA256 d91b302bdf9583cc769c664d98a28f76d8d34d635a0446a14833ad4f5b6ef61d xsys-2.1.0.tar.bz2 16499 |