<pre style='margin:0'>
Ken (kencu) pushed a commit to branch master
in repository macports-legacy-support.
</pre>
<p><a href="https://github.com/macports/macports-legacy-support/commit/e0240afb4c9f10022f02c440d307ba2b826750e1">https://github.com/macports/macports-legacy-support/commit/e0240afb4c9f10022f02c440d307ba2b826750e1</a></p>
<pre style="white-space: pre; background: #F8F8F8">The following commit(s) were added to refs/heads/master by this push:
<span style='display:block; white-space:pre;color:#404040;'> new e0240af add a return value for sysconf and test for failure
</span>e0240af is described below
<span style='display:block; white-space:pre;color:#808000;'>commit e0240afb4c9f10022f02c440d307ba2b826750e1
</span>Author: ken-cunningham-webuse <ken.cunningham.webuse@gmail.com>
AuthorDate: Thu Jan 24 19:58:33 2019 -0800
<span style='display:block; white-space:pre;color:#404040;'> add a return value for sysconf and test for failure
</span>---
src/macports_legacy_sysconf.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/src/macports_legacy_sysconf.c b/src/macports_legacy_sysconf.c
</span><span style='display:block; white-space:pre;color:#808080;'>index bb96fc4..2dca994 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/src/macports_legacy_sysconf.c
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/src/macports_legacy_sysconf.c
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -45,13 +45,14 @@ long macports_legacy_sysconf(int name){
</span> if ( name == _SC_NPROCESSORS_ONLN ) {
int nm[2];
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ int ret;
</span> size_t len = 4;
uint32_t count;
nm[0] = CTL_HW; nm[1] = HW_AVAILCPU;
<span style='display:block; white-space:pre;background:#ffe0e0;'>- sysctl(nm, 2, &count, &len, NULL, 0);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ret = sysctl(nm, 2, &count, &len, NULL, 0);
</span>
<span style='display:block; white-space:pre;background:#ffe0e0;'>- if (count < 1) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if (ret < 0 || count < 1) {
</span> /* try again with _SC_NPROCESSORS_CONF */
return macports_legacy_sysconf(_SC_NPROCESSORS_CONF);
} else {
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -62,14 +63,15 @@ long macports_legacy_sysconf(int name){
</span> if ( name == _SC_NPROCESSORS_CONF ) {
int nm[2];
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ int ret;
</span> size_t len = 4;
uint32_t count;
nm[0] = CTL_HW; nm[1] = HW_NCPU;
<span style='display:block; white-space:pre;background:#ffe0e0;'>- sysctl(nm, 2, &count, &len, NULL, 0);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ret = sysctl(nm, 2, &count, &len, NULL, 0);
</span>
/* there has to be at least 1 processor */
<span style='display:block; white-space:pre;background:#ffe0e0;'>- if (count < 1) { count = 1; }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if (ret < 0 || count < 1) { count = 1; }
</span> return (long)count;
}
</pre><pre style='margin:0'>
</pre>