2008-10-08 18:23:52 +02:00
|
|
|
Index: libvirt-0.4.5/src/storage_backend_fs.c
|
2008-09-01 17:06:07 +02:00
|
|
|
===================================================================
|
2008-10-08 18:23:52 +02:00
|
|
|
--- libvirt-0.4.5.orig/src/storage_backend_fs.c
|
|
|
|
+++ libvirt-0.4.5/src/storage_backend_fs.c
|
|
|
|
@@ -583,7 +583,9 @@ virStorageBackendFileSystemIsMounted(vir
|
2008-09-01 17:06:07 +02:00
|
|
|
virStoragePoolObjPtr pool) {
|
|
|
|
FILE *mtab;
|
|
|
|
struct mntent *ent;
|
|
|
|
-
|
|
|
|
+ char *mpoint;
|
|
|
|
+ size_t len;
|
|
|
|
+
|
|
|
|
if ((mtab = fopen(_PATH_MOUNTED, "r")) == NULL) {
|
|
|
|
virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
|
|
|
|
_("cannot read %s: %s"),
|
2008-10-08 18:23:52 +02:00
|
|
|
@@ -591,14 +593,27 @@ virStorageBackendFileSystemIsMounted(vir
|
2008-09-01 17:06:07 +02:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
+ if ((mpoint = strdup(pool->def->target.path)) == NULL) {
|
|
|
|
+ virStorageReportError(conn, VIR_ERR_NO_MEMORY,
|
|
|
|
+ "%s", strerror(errno));
|
|
|
|
+ return -1;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ len = strlen(mpoint);
|
|
|
|
+ if (mpoint[len-1] == '/')
|
|
|
|
+ mpoint[len-1] = NULL;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
while ((ent = getmntent(mtab)) != NULL) {
|
|
|
|
- if (STREQ(ent->mnt_dir, pool->def->target.path)) {
|
|
|
|
+ if (STREQ(ent->mnt_dir, mpoint)) {
|
|
|
|
fclose(mtab);
|
|
|
|
+ free(mpoint);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fclose(mtab);
|
|
|
|
+ free(mpoint);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2008-10-08 18:23:52 +02:00
|
|
|
@@ -951,12 +966,16 @@ virStorageBackendFileSystemDelete(virCon
|
2008-09-01 17:06:07 +02:00
|
|
|
{
|
|
|
|
/* XXX delete all vols first ? */
|
|
|
|
|
|
|
|
+ /* target.path is never created AFAIKT, so dont delete it. */
|
|
|
|
+#if 0
|
|
|
|
+
|
|
|
|
if (unlink(pool->def->target.path) < 0) {
|
|
|
|
virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
|
|
|
|
_("cannot unlink path '%s': %s"),
|
|
|
|
pool->def->target.path, strerror(errno));
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|