int size = 0, alloc = 0;
DIR *dir;
- struct dirent *d;
int err = 0;
dir = opendir ("/sys/block");
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 ||
}
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);