Accepting request 242817 from home:juwolf:branches:Base:System
Fixed patch 0001-Fixed-segfault-when-no-node-could-be-found-in-sysfs-.patch for bnc#872922 OBS-URL: https://build.opensuse.org/request/show/242817 OBS-URL: https://build.opensuse.org/package/show/Base:System/numactl?expand=0&rev=46
This commit is contained in:
parent
a9e0e5bc30
commit
d2661eb6b4
@ -1,49 +1,43 @@
|
|||||||
From a60b4ae108d7853f604e2d75147f6175ba908dfd Mon Sep 17 00:00:00 2001
|
From 5dce07818a2f2c6ebde399f58702fe5beecb2eed Mon Sep 17 00:00:00 2001
|
||||||
From: Julian Wolf <juwolf@suse.com>
|
From: Julian Wolf <juwolf@suse.com>
|
||||||
Date: Fri, 13 Jun 2014 14:24:36 +0200
|
Date: Fri, 18 Jul 2014 14:05:05 +0200
|
||||||
Subject: [PATCH] Fixed segfault when no node could be found in sysfs
|
Subject: [PATCH] Fixed segfault when no node could be found in sysfs
|
||||||
bnc#872922
|
bnc#872922
|
||||||
|
|
||||||
---
|
---
|
||||||
distance.c | 7 +++++--
|
distance.c | 15 ++++++---------
|
||||||
1 file changed, 5 insertions(+), 2 deletions(-)
|
1 file changed, 6 insertions(+), 9 deletions(-)
|
||||||
|
|
||||||
diff --git a/distance.c b/distance.c
|
diff --git a/distance.c b/distance.c
|
||||||
index 4a26972..84affa3 100755
|
index 4a26972..5db7fe2 100755
|
||||||
--- a/distance.c
|
--- a/distance.c
|
||||||
+++ b/distance.c
|
+++ b/distance.c
|
||||||
@@ -57,6 +57,7 @@ static int read_distance_table(void)
|
@@ -58,19 +58,16 @@ static int read_distance_table(void)
|
||||||
int maxnode = numa_max_node() + 1;
|
|
||||||
int *table = NULL;
|
int *table = NULL;
|
||||||
int err = -1;
|
int err = -1;
|
||||||
+ int cnt = 0;
|
|
||||||
|
|
||||||
for (nd = 0;; nd++) {
|
- for (nd = 0;; nd++) {
|
||||||
|
+ for (nd = 0; nd < maxnode; nd++) {
|
||||||
char fn[100];
|
char fn[100];
|
||||||
@@ -70,6 +71,8 @@ static int read_distance_table(void)
|
FILE *dfh;
|
||||||
continue;
|
sprintf(fn, "/sys/devices/system/node/node%d/distance", nd);
|
||||||
else
|
dfh = fopen(fn, "r");
|
||||||
break;
|
- if (!dfh) {
|
||||||
+ }else {
|
- if (errno == ENOENT)
|
||||||
+ cnt++;
|
- err = 0;
|
||||||
}
|
- if (!err && nd<maxnode)
|
||||||
|
- continue;
|
||||||
|
- else
|
||||||
|
- break;
|
||||||
|
- }
|
||||||
|
+ if (dfh)
|
||||||
|
+ err = 0;
|
||||||
|
+ else
|
||||||
|
+ continue;
|
||||||
|
+
|
||||||
len = getdelim(&line, &linelen, '\n', dfh);
|
len = getdelim(&line, &linelen, '\n', dfh);
|
||||||
fclose(dfh);
|
fclose(dfh);
|
||||||
@@ -87,12 +90,12 @@ static int read_distance_table(void)
|
if (len <= 0)
|
||||||
parse_numbers(line, table + nd * maxnode);
|
|
||||||
}
|
|
||||||
free(line);
|
|
||||||
- if (err) {
|
|
||||||
+ if (err || !cnt) {
|
|
||||||
numa_warn(W_distance,
|
|
||||||
"Cannot parse distance information in sysfs: %s",
|
|
||||||
strerror(errno));
|
|
||||||
free(table);
|
|
||||||
- return err;
|
|
||||||
+ return -1;
|
|
||||||
}
|
|
||||||
/* Update the global table pointer. Race window here with
|
|
||||||
other threads, but in the worst case we leak one distance
|
|
||||||
--
|
--
|
||||||
1.8.1.4
|
1.8.1.4
|
||||||
|
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Tue Jul 29 08:26:28 UTC 2014 - juwolf@suse.com
|
||||||
|
|
||||||
|
- Fixed patch 0001-Fixed-segfault-when-no-node-could-be-found-in-sysfs-.patch
|
||||||
|
for bnc#872922
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Fri Jun 13 14:27:32 UTC 2014 - juwolf@suse.com
|
Fri Jun 13 14:27:32 UTC 2014 - juwolf@suse.com
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user