summaryrefslogtreecommitdiff
path: root/daemon/gvfsjobunmount.c
diff options
context:
space:
mode:
authorGiovanni Campagna <gcampagna@src.gnome.org>2012-02-07 15:25:05 +0100
committerTomas Bzatek <tbzatek@redhat.com>2012-02-07 15:25:05 +0100
commite523572e14a9042696e1c5ccd4f30cb3240fa0df (patch)
treeea341d07241b51e9b1adc357d05be7dbe101416c /daemon/gvfsjobunmount.c
parent989d0889afe34a0ce072edf9840b6d18314a00b3 (diff)
downloadgvfs-e523572e14a9042696e1c5ccd4f30cb3240fa0df.tar.gz
GVfsJobUnmount: check that vfunc is implemented before calling it
GVfsBackend::try_unmount is optional (like all the other try_* vfuncs), and in fact many backends don't implement it. In case it's NULL, returing FALSE does the right thing and schedules a thread for calling ->unmount. https://bugzilla.gnome.org/show_bug.cgi?id=669211
Diffstat (limited to 'daemon/gvfsjobunmount.c')
-rw-r--r--daemon/gvfsjobunmount.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/daemon/gvfsjobunmount.c b/daemon/gvfsjobunmount.c
index d31b36e5..85873f9d 100644
--- a/daemon/gvfsjobunmount.c
+++ b/daemon/gvfsjobunmount.c
@@ -130,6 +130,9 @@ run (GVfsJob *job)
GVfsJobUnmount *op_job = G_VFS_JOB_UNMOUNT (job);
GVfsBackendClass *class = G_VFS_BACKEND_GET_CLASS (op_job->backend);
+ if (class->unmount == NULL)
+ return;
+
class->unmount (op_job->backend,
op_job,
op_job->flags,
@@ -218,11 +221,13 @@ try (GVfsJob *job)
if (job_finish_immediately_if_possible (op_job))
return TRUE;
- else
+ else if (class->try_unmount != NULL)
return class->try_unmount (op_job->backend,
op_job,
op_job->flags,
op_job->mount_source);
+ else
+ return FALSE;
}
static void