Re: chown and symbolic links



Hi!
Fr?d?ric L. W. Meunier wrote:
: Hi. I'd like to know why and when the behavior of chown with
: symbolic links was modified in Midnight Commander.
: 
: ~2 years ago I was able to chown a symbolic link. Now chown
: modifies the library or any other file the symbolic links
: points to.

It seems I answed this question some time ago.
I guess you are using Linux with 2.2+ kernel now and you used 2.0 
kernel ~2 years ago. There is NOTES section from chown (2) man page.
. . .
NOTES
       In versions of Linux prior to 2.1.81  (and  distinct  from
       2.1.46), chown did not follow symbolic links.  Since Linux
       2.1.81, chown does follow symbolic links, and there  is  a
       new  system  call  lchown  that  does  not follow symbolic
       links.  Since Linux 2.1.86, this new call  (that  has  the
       same  semantics as the old chown) has got the same syscall
       number, and chown got the newly introduced number.
. . .

: How do I get the old behavior ?

There is a dirty hack below.

Index: local.c
===================================================================
RCS file: /cvs/gnome/mc/vfs/local.c,v
retrieving revision 1.13
diff -u -p -r1.13 local.c
--- local.c     2001/06/25 21:34:46     1.13
+++ local.c     2001/06/27 13:17:39
@@ -159,7 +159,11 @@ local_chmod (vfs *me, char *path, int mo
 static int
 local_chown (vfs *me, char *path, int owner, int group)
 {
+#ifdef HAVE_LCHOWN
+    return lchown (path, owner, group);
+#else
     return chown (path, owner, group);
+#endif
 }
 
 static int




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]