aboutsummaryrefslogtreecommitdiffstats
path: root/main/libvirt
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2014-04-21 11:03:54 +0200
committerNatanael Copa <ncopa@alpinelinux.org>2014-04-21 11:09:02 +0200
commit591c54c93e9121a8d60651a964517db267af3b1c (patch)
tree78d7efad1c8f58037cf44840dd1fabddc37c184e /main/libvirt
parent271f4bc087af535a4a471a1e23a8edba2db90b3f (diff)
downloadaports-591c54c93e9121a8d60651a964517db267af3b1c.tar.bz2
aports-591c54c93e9121a8d60651a964517db267af3b1c.tar.xz
main/libvirt: update the readdir patch
Diffstat (limited to 'main/libvirt')
-rw-r--r--main/libvirt/APKBUILD8
-rw-r--r--main/libvirt/nodeinfo-musl.patch109
2 files changed, 100 insertions, 17 deletions
diff --git a/main/libvirt/APKBUILD b/main/libvirt/APKBUILD
index 6c69cfaa40..4a85e30ce3 100644
--- a/main/libvirt/APKBUILD
+++ b/main/libvirt/APKBUILD
@@ -2,7 +2,7 @@
pkgname=libvirt
pkgver=1.2.3
_ver="${pkgver/_rc/-rc}"
-pkgrel=2
+pkgrel=3
pkgdesc="A virtualization API for several hypervisor and container systems"
url="http://libvirt.org/"
arch="all"
@@ -173,16 +173,16 @@ md5sums="ad1602a2fcc3609c83b885a28f3eecbd libvirt-1.2.3.tar.gz
d897df38c7e7fa1a297aa551108633c9 libvirt.initd
2d44db1a1e849decd709ccf07098c475 physmem.patch
9da7723b114b2d87558e92828366fbcb musl-fix-includes.patch
-aea5a4bd25176fcc1333986c5932ecc2 nodeinfo-musl.patch"
+b72fb72fdd8727aa0393f8b627bbe57b nodeinfo-musl.patch"
sha256sums="b489d1a29c6166643d34b72795a89b03c6ac775cdaeadb6aa86fc1a982c02e31 libvirt-1.2.3.tar.gz
851ab3f9678f0fa9c3ee03f7fc7bd00c4ee86d5f0777eecf9eb1ffe3243adfd1 libvirt.confd
e9fad203434ffaa6afe524e42a9fb6594edad61cb02b1ca60a68d1a7fe0c31ab libvirt.initd
316a9783c162757d2b8530a65eccdc0d25975037699844679ffc3c7aee5206a6 physmem.patch
8dfa9dbe71ee21dc53e44bd7cc0127adde1bf3371d6b393657b386bb83f8139b musl-fix-includes.patch
-7203f304eaf15f915c8a0551c9a5ea5f6646c9c6d937e399eda530d7be803768 nodeinfo-musl.patch"
+cbd60f09a0e666a22ed3f8cfb9670820c46796c56a4254ed1f84b5371c33f501 nodeinfo-musl.patch"
sha512sums="5ff85a98a0c62229d0ab8125d20fce982f8497d20cb89758bc37f475d7a5d59caa6d962e6c2313e1c494ca1648a836fcad253ceaccc34cc0060135470be3db5b libvirt-1.2.3.tar.gz
9aba6ab73219a635c64a340ee8887356e644445c9128734cbce73f5d54778378da2f10a190365ad88a7db8bc95b1fb17f0c6ca41fc41bb786c09e1afe84d65dc libvirt.confd
f48c97f93ef4509a86eda6200b3aae5b2c0c6263403bde933b770fd62240dca27bc439bd29b440ea6a47c8337f8b4511230ed915cb5ff54d9a1cf311863f6fa1 libvirt.initd
4c876a89dee4cc793ce64a0bf43db4f493d1d47409a9fab727b8b0f182e4b25017aa4371afd96ce081dab4aa3e93c6c5ad46e0e6fc2c2076a9da50632ef7f06e physmem.patch
b6142256bf2700b9e5335c60fe5628e4095a24689c31d54afcab46f46a06b9c0ae676f87f77a487377eafbec11fb7afa9b994aef48a10a39e82f47c45df008ba musl-fix-includes.patch
-62267f24bc6c2baa8f09d0a56abc1cb39997b54ce665878f7e187bb87e2f25cc358849a63f2b10f43ce0f56d62261507ab5c0a6ad1874722b33f4e1329c4df34 nodeinfo-musl.patch"
+e479bf1317fd30136dbc3bb76d6dfb59934a36fa6db67087c8f0898558d797db40e2e963bb990446479f8d4d7ead25e95876a3d43245034376b8418a4805f3e2 nodeinfo-musl.patch"
diff --git a/main/libvirt/nodeinfo-musl.patch b/main/libvirt/nodeinfo-musl.patch
index f7c855e6d9..85caf31a5b 100644
--- a/main/libvirt/nodeinfo-musl.patch
+++ b/main/libvirt/nodeinfo-musl.patch
@@ -1,18 +1,26 @@
diff --git a/src/nodeinfo.c b/src/nodeinfo.c
-index 53ba716..8d3214e 100644
+index 53ba716..f239d4a 100644
--- a/src/nodeinfo.c
+++ b/src/nodeinfo.c
-@@ -452,8 +452,7 @@ virNodeParseNode(const char *node,
+@@ -440,6 +440,7 @@ virNodeParseNode(const char *node,
+ int siblings;
+ unsigned int cpu;
+ int online;
++ int direrr;
+
+ *threads = 0;
+ *cores = 0;
+@@ -452,8 +453,7 @@ virNodeParseNode(const char *node,
/* enumerate sockets in the node */
CPU_ZERO(&sock_map);
- errno = 0;
- while ((cpudirent = readdir(cpudir))) {
-+ for (errno = 0; (cpudirent = readdir(cpudir)); errno = 0) {
++ while ((direrr = virDirRead(cpudir, &cpudirent, node)) == 0) {
if (sscanf(cpudirent->d_name, "cpu%u", &cpu) != 1)
continue;
-@@ -470,8 +469,6 @@ virNodeParseNode(const char *node,
+@@ -470,14 +470,10 @@ virNodeParseNode(const char *node,
if (sock > sock_max)
sock_max = sock;
@@ -20,18 +28,25 @@ index 53ba716..8d3214e 100644
- errno = 0;
}
- if (errno) {
-@@ -490,8 +487,7 @@ virNodeParseNode(const char *node,
+- if (errno) {
+- virReportSystemError(errno, _("problem reading %s"), node);
++ if (direrr < 0)
+ goto cleanup;
+- }
+
+ sock_max++;
+
+@@ -490,8 +486,7 @@ virNodeParseNode(const char *node,
/* iterate over all CPU's in the node */
rewinddir(cpudir);
- errno = 0;
- while ((cpudirent = readdir(cpudir))) {
-+ for (errno = 0; (cpudirent = readdir(cpudir)); errno = 0) {
++ while ((direrr = virDirRead(cpudir, &cpudirent, node)) == 0) {
if (sscanf(cpudirent->d_name, "cpu%u", &cpu) != 1)
continue;
-@@ -530,8 +526,6 @@ virNodeParseNode(const char *node,
+@@ -530,14 +525,10 @@ virNodeParseNode(const char *node,
if (siblings > *threads)
*threads = siblings;
@@ -39,18 +54,33 @@ index 53ba716..8d3214e 100644
- errno = 0;
}
- if (errno) {
-@@ -672,8 +666,7 @@ int linuxNodeInfoCPUPopulate(FILE *cpuinfo,
+- if (errno) {
+- virReportSystemError(errno, _("problem reading %s"), node);
++ if (direrr < 0)
+ goto cleanup;
+- }
+
+ /* finalize the returned data */
+ *sockets = CPU_COUNT(&sock_map);
+@@ -576,6 +567,7 @@ int linuxNodeInfoCPUPopulate(FILE *cpuinfo,
+ int ret = -1;
+ char *sysfs_nodedir = NULL;
+ char *sysfs_cpudir = NULL;
++ int direrr;
+
+ /* Start with parsing CPU clock speed from /proc/cpuinfo */
+ while (fgets(line, sizeof(line), cpuinfo) != NULL) {
+@@ -672,8 +664,7 @@ int linuxNodeInfoCPUPopulate(FILE *cpuinfo,
goto fallback;
}
- errno = 0;
- while ((nodedirent = readdir(nodedir))) {
-+ for (errno = 0; (nodedirent = readdir(nodedir)); errno = 0) {
++ while ((direrr = virDirRead(nodedir, &nodedirent, sysfs_nodedir)) == 0) {
if (sscanf(nodedirent->d_name, "node%u", &node) != 1)
continue;
-@@ -699,8 +692,6 @@ int linuxNodeInfoCPUPopulate(FILE *cpuinfo,
+@@ -699,14 +690,10 @@ int linuxNodeInfoCPUPopulate(FILE *cpuinfo,
if (threads > nodeinfo->threads)
nodeinfo->threads = threads;
@@ -58,4 +88,57 @@ index 53ba716..8d3214e 100644
- errno = 0;
}
- if (errno) {
+- if (errno) {
+- virReportSystemError(errno, _("problem reading %s"), sysfs_nodedir);
++ if (direrr < 0)
+ goto cleanup;
+- }
+
+ if (nodeinfo->cpus && nodeinfo->nodes)
+ goto done;
+diff --git a/src/util/virfile.c b/src/util/virfile.c
+index 3eb2703..b54b9fd 100644
+--- a/src/util/virfile.c
++++ b/src/util/virfile.c
+@@ -2295,6 +2295,20 @@ virDirCreate(const char *path ATTRIBUTE_UNUSED,
+ }
+ #endif /* WIN32 */
+
++/* return 0 = success, 1 = end-of-dir and -1 = error */
++int virDirRead(DIR *dirp, struct dirent **ent, const char *dirname)
++{
++ errno = 0;
++ *ent = readdir(dirp);
++ if (!*ent && errno) {
++ if (dirname)
++ virReportSystemError(errno, _("Unable to read directory '%s'"),
++ dirname);
++ return -1;
++ }
++ return !*ent;
++}
++
+ static int
+ virFileMakePathHelper(char *path, mode_t mode)
+ {
+diff --git a/src/util/virfile.h b/src/util/virfile.h
+index 46ef781..622a81b 100644
+--- a/src/util/virfile.h
++++ b/src/util/virfile.h
+@@ -27,6 +27,7 @@
+ # define __VIR_FILE_H_
+
+ # include <stdio.h>
++# include <dirent.h>
+
+ # include "internal.h"
+ # include "virstoragefile.h"
+@@ -211,6 +212,8 @@ enum {
+ };
+ int virDirCreate(const char *path, mode_t mode, uid_t uid, gid_t gid,
+ unsigned int flags) ATTRIBUTE_RETURN_CHECK;
++int virDirRead(DIR *dirp, struct dirent **ent, const char *dirname);
++
+ int virFileMakePath(const char *path) ATTRIBUTE_RETURN_CHECK;
+ int virFileMakePathWithMode(const char *path,
+ mode_t mode) ATTRIBUTE_RETURN_CHECK;