gvfs r1791 - in branches/gnome-2-22: . daemon
- From: tbzatek svn gnome org
- To: svn-commits-list gnome org
- Subject: gvfs r1791 - in branches/gnome-2-22: . daemon
- Date: Wed, 28 May 2008 16:04:12 +0000 (UTC)
Author: tbzatek
Date: Wed May 28 16:04:12 2008
New Revision: 1791
URL: http://svn.gnome.org/viewvc/gvfs?rev=1791&view=rev
Log:
Return G_IO_ERROR_IS_DIRECTORY when attempting to read a directory (fixes #522933 for SMB)
Modified:
branches/gnome-2-22/ChangeLog
branches/gnome-2-22/daemon/gvfsbackendsmb.c
Modified: branches/gnome-2-22/daemon/gvfsbackendsmb.c
==============================================================================
--- branches/gnome-2-22/daemon/gvfsbackendsmb.c (original)
+++ branches/gnome-2-22/daemon/gvfsbackendsmb.c Wed May 28 16:04:12 2008
@@ -612,17 +612,33 @@
GVfsBackendSmb *op_backend = G_VFS_BACKEND_SMB (backend);
char *uri;
SMBCFILE *file;
+ struct stat st;
smbc_open_fn smbc_open;
+ smbc_stat_fn smbc_stat;
+ int res;
+ int olderr;
+
uri = create_smb_uri (op_backend->server, op_backend->share, filename);
smbc_open = smbc_getFunctionOpen (op_backend->smb_context);
file = smbc_open (op_backend->smb_context, uri, O_RDONLY, 0);
- g_free (uri);
if (file == NULL)
- g_vfs_job_failed_from_errno (G_VFS_JOB (job), errno);
+ {
+ olderr = errno;
+ smbc_stat = smbc_getFunctionStat (op_backend->smb_context);
+ res = smbc_stat (op_backend->smb_context, uri, &st);
+ g_free (uri);
+ if ((res == 0) && (S_ISDIR (st.st_mode)))
+ g_vfs_job_failed (G_VFS_JOB (job),
+ G_IO_ERROR, G_IO_ERROR_IS_DIRECTORY,
+ _("Can't open directory"));
+ else
+ g_vfs_job_failed_from_errno (G_VFS_JOB (job), olderr);
+ }
else
{
+
g_vfs_job_open_for_read_set_can_seek (job, TRUE);
g_vfs_job_open_for_read_set_handle (job, file);
g_vfs_job_succeeded (G_VFS_JOB (job));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]