Re: Discovering if a file is read-only
- From: Alexander Larsson <alexl redhat com>
- To: Murray Cumming <murrayc murrayc com>
- Cc: gnome-vfs-list <gnome-vfs-list gnome org>
- Subject: Re: Discovering if a file is read-only
- Date: 11 Jun 2004 07:57:22 +0200
On Thu, 2004-06-10 at 16:26, Murray Cumming wrote:
> On Wed, 2004-06-09 at 12:01 +0200, Alexander Larsson wrote:
> > On Tue, 2004-06-08 at 23:54, Murray Cumming wrote:
> > > I am examining GnomeVfsFileInfo::permissions on a GnomeVfsFileInfo that
> > > I got from gnome_vfs_get_file_info_from_handle() after opening the
> > > GnomeVfsUriHandle with gnome_vfs_open(), with the GNOME_VFS_OPEN_READ
> > > option.
> > >
> > > When I use it on a local file that is not writable by the group, user,
> > > or others, it does not seem to set the GNOME_VFS_PERM_ACCESS_WRITABLE
> > > flag.
> > >
> > > So, should I be able to use GNOME_VFS_PERM_ACCESS_WRITABLE to check
> > > whether the file is writable by the current user? Or do I need to use
> > > GNOME_VFS_PERM_USER_WRITE, GNOME_VFS_PERM_GROUP_WRITE,
> > > GNOME_VFS_PERM_OTHERS_WRITE and check whether the user is in the correct
> > > group?
> >
> > Yes, that is the general idea. However you need to pass
> > GNOME_VFS_FILE_INFO_GET_ACCESS_RIGHTS to get_file_info in the options
> > parameter.
>
> Oh, yes. We use _DEFAULT as the default value in gnome-vfsmm, but it
> does not seem to do anything useful.
>
> > Also, looking at the code this only seems to be implemented
> > for get_file_info, not get_file_info_from_handle().
>
> That version makes my code look nicer anyway, and it does work. Thanks.
> I was also getting my boolean check for the flag completely wrong.
>
> > I guess we need to
> > implement that.
>
> I can confirm that. It does not seem to work when using the
> _from_handle: It never sets the GNOME_VFS_PERM_ACCESS_WRITABLE.
>
> But I don't see where the problem is. I am comparing
> gnome_vfs_get_file_info_uri_cancellable() and
> gnome_vfs_get_file_info_from_handle_cancellable(), which seem to do much
> the same thing.
The problem is in the file module. Compare
modules/file-method.c:do_get_file_info_from_handle and do_get_file_info.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Alexander Larsson Red Hat, Inc
alexl redhat com alla lysator liu se
He's a gun-slinging guitar-strumming waffle chef whom everyone believes is
mad. She's a provocative renegade wrestler from a family of eight older
brothers. They fight crime!
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]