forked from pool/libvirt
62 lines
1.7 KiB
Diff
62 lines
1.7 KiB
Diff
|
Index: libvirt-0.4.4/src/storage_backend_fs.c
|
||
|
===================================================================
|
||
|
--- libvirt-0.4.4.orig/src/storage_backend_fs.c
|
||
|
+++ libvirt-0.4.4/src/storage_backend_fs.c
|
||
|
@@ -455,7 +455,9 @@ virStorageBackendFileSystemIsMounted(vir
|
||
|
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"),
|
||
|
@@ -463,14 +465,27 @@ virStorageBackendFileSystemIsMounted(vir
|
||
|
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;
|
||
|
}
|
||
|
|
||
|
@@ -797,12 +812,16 @@ virStorageBackendFileSystemDelete(virCon
|
||
|
{
|
||
|
/* 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;
|
||
|
}
|