git.annexia.org
/
libguestfs.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
generator.ml: use new "Pathname" designation
[libguestfs.git]
/
daemon
/
devsparts.c
diff --git
a/daemon/devsparts.c
b/daemon/devsparts.c
index
b89682c
..
b4ea578
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;
int size = 0, alloc = 0;
DIR *dir;
- struct dirent *d;
int err = 0;
dir = opendir ("/sys/block");
int err = 0;
dir = opendir ("/sys/block");
@@
-49,8
+48,11
@@
foreach_block_device (block_dev_func_t func)
return NULL;
}
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 ||
if (strncmp (d->d_name, "sd", 2) == 0 ||
strncmp (d->d_name, "hd", 2) == 0 ||
strncmp (d->d_name, "vd", 2) == 0 ||
@@
-186,13
+188,11
@@
do_list_partitions (void)
}
int
}
int
-do_mkfs (c
har *fstype,
char *device)
+do_mkfs (c
onst char *fstype, const
char *device)
{
char *err;
int r;
{
char *err;
int r;
- IS_DEVICE (device, -1);
-
r = command (NULL, &err, "/sbin/mkfs", "-t", fstype, device, NULL);
if (r == -1) {
reply_with_error ("mkfs: %s", err);
r = command (NULL, &err, "/sbin/mkfs", "-t", fstype, device, NULL);
if (r == -1) {
reply_with_error ("mkfs: %s", err);