generator.ml: use new "Pathname" designation
[libguestfs.git] / daemon / devsparts.c
index b89682c..b4ea578 100644 (file)
@@ -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 ||
@@ -186,13 +188,11 @@ do_list_partitions (void)
 }
 
 int
-do_mkfs (char *fstype, char *device)
+do_mkfs (const char *fstype, const char *device)
 {
   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);