lkml.org 
[lkml]   [1996]   [Jul]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: How does chown(2) works with symlinks?
    Linus Torvalds wrote:
    > If you want to change the owner of the file it points to, use:
    >
    > fd = open(...);
    > fchown(fd,..);
    >
    > which should always work the way you expect.

    So long as you can open the file. Its possible you want to chown a file
    you own
    but can't open, and if chmod is consistent with chown (which I certainly
    hope
    is the case), you won't be able to chmod it before trying to open it.

    > If you use "chown()" on the
    > pathname it will change the synlink itself (if you think about it, that is
    > actually the reasonable behaviour: otherwise you could never change the owner
    > of the symlink).

    It might be reasonable behaviour if there were ever a need to change the
    owner
    of a symlink. However, seeing as a symlink is a mere loophole in the
    namespace
    and has no function in itself, the owner, like its mode, is completely
    irrelevent.
    The only time I can think of where you'd care about the owner is for
    quotas, and
    even then that's pretty insignificant.

    It seems to me that not following symlinks will be more surprising than
    following
    them, and therefore more likely to open holes.

    J



    \
     
     \ /
      Last update: 2005-03-22 13:37    [W:0.019 / U:90.256 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site