git.annexia.org
/
libguestfs.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
5d78de8
)
Fix errno check in readdir in devsparts.c
author
Matthew Booth
<mbooth@redhat.com>
Thu, 6 Aug 2009 13:14:18 +0000
(14:14 +0100)
committer
Matthew Booth
<mbooth@redhat.com>
Thu, 6 Aug 2009 13:36:08 +0000
(14:36 +0100)
daemon/devsparts.c
patch
|
blob
|
history
diff --git
a/daemon/devsparts.c
b/daemon/devsparts.c
index
b89682c
..
e9c5e8f
100644
(file)
--- a/
daemon/devsparts.c
+++ b/
daemon/devsparts.c
@@
-40,7
+40,6
@@
foreach_block_device (block_dev_func_t func)
int size = 0, alloc = 0;
DIR *dir;
- struct dirent *d;
int err = 0;
dir = opendir ("/sys/block");
@@
-49,8
+48,11
@@
foreach_block_device (block_dev_func_t func)
return NULL;
}
- errno = 0;
- while ((d = readdir (dir)) != NULL) {
+ while(1) {
+ errno = 0;
+ struct dirent *d = readdir(dir);
+ if(NULL == d) break;
+
if (strncmp (d->d_name, "sd", 2) == 0 ||
strncmp (d->d_name, "hd", 2) == 0 ||
strncmp (d->d_name, "vd", 2) == 0 ||