On Fri, 2006-06-23 at 09:27 +0200, Steffen Kaiser wrote:
On Fri, 23 Jun 2006, Scott Alter wrote:
name and the group name must currently be the same. Does anyone know of a way to capture the group that the user writes files as?
Actually, this is not as easy as it sounds, because an user can be member of more than just one group and some filesystems allow to force a particular group on newly created files (e.g. via mount or setgid on the directory). But I suppose that the getegid() style you use in the patch is what most people are using.
Bye,
Attached is a getfsgid() call that I have used in the past for this very purpose on Linux. It shouldn't be too hard to make work on other platforms...
It checks /etc/mtab (should probably also check /etc/mnttab, but none of my systems use that anymore), checks setgid bit on dir, and falls back on getegid()
-- Internet Connection High Quality Web Hosting http://www.internetconnection.net/