Messages in this thread | | | Date | Mon, 1 Nov 2004 15:20:54 +0100 (MET) | From | Jan Engelhardt <> | Subject | Re: Fchown on unix domain sockets? |
| |
>Please CC any reply to jmc AT xisl.com as I'm not subscribed. > >I wanted to change the ownership on a unix domain socket in a program (running >as root) I was writing and I was wondering if "fchown" worked on the socket >descriptor (after I'd run "bind" of course). > >It doesn't, you have to use "chown" on the path name - however "fchown" >silently does nothing, it doesn't report an error.
I think that's normal, because chown() applies to an object in the filesystem, while fchown() applies to the FD. (In fact, it applies to an inode.) However, socket fd of any kind don't have an associated inode, because, well sockets are not stored on the filesystem.
As some manpage might say, the socket thing you see in "ls -l" is just a reference thing. When you connect to it, ls -l /proc/pidofprogram/fd/ does not show the path, but [socket:xxxx] which shows that the filesystem object is not used anymore.
>I don't mind it not working but I think it should report an error. This is on >2.6.3 kernel.
What would you like it to do? EINVAL like the others or change the actual inode's permission?
Jan Engelhardt -- Gesellschaft für Wissenschaftliche Datenverarbeitung Am Fassberg, 37077 Göttingen, www.gwdg.de - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |