jed-users mailing list

[2005 Date Index] [2005 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

Re: Read only files.


Misha Gorodnitzky <misaka@xxxxxxxxx> wrote:
>Not as root I don't. Only when the file is truly un-writable, such as  
>when I edit a 0444 file as a non-privileged user, jed does as you  
>say. I'm using 0.99.16, by the way, I don't have 0.99.17 anywhere to  
>try out.

To determine if a file is to be regarded as read-only, the `access`
system call is used.  Unfortunately, this system call appears to
indicate that root has write permission to a file even if it has not
permission bits set.

The next release will contain a patch using the stat system to obtain
the permission bits, and explicitly test those.

In the meantime, you can use the global_mode_hook to perform this test:

   define global_mode_hook (mode_name)
   {
      variable file = buffer_filename ();
      variable st = stat_file (file);
      if (st != NULL)
	set_readonly (0 == (st.st_mode & S_IWUSR));
   }

Hopefully this will work for you.
  
Thanks,
--John


--------------------------
To unsubscribe send email to <jed-users-request@xxxxxxxxxxx> with
the word "unsubscribe" in the message body.
Need help? Email <jed-users-owner@xxxxxxxxxxx>.


[2005 date index] [2005 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]