He's talking about the different 'group' setting.. I think.

it's different because SYSV (linux is based on the semantics of sysV) and
BSD have a differnt semantic on this and always have..
BSD makes the file get the same group as the directory.
Linux gives it the primary group of the creator. Linux can act the same
as BSD if the SGID bit is set on the directory (I think).
There may also be a mount option but I'm not sure if that was ever
implelemnted.


On Wed, 16 Jan 2002, Greg Black wrote:

> Foldi Tamas wrote:
> 
> | Hello hackers,
> 
> Don't send this sort of newbie programmer question to the
> hackers list (or to any of the FreeBSD lists).
> 
> |     I tried the following program on Tru64, FreeBSD and linux:
> | 
> | #include <stdio.h>
> | #include <fcntl.h>
> | #include <sys/stat.h>
> | #include <sys/types.h>
> | main() {
> |         int fd;
> |         fd = open ( "/tmp/foobar", (O_RDWR | O_CREAT),  0020);
> |         perror("open");
> |         close(fd);
> | }
> | 
> | The program ran successfully, but the created file was different.
> | On Linux:
> |     -----w----    1 crow     crow            0 Jan 16 10:32 /tmp/foobar
> | 
> | On Tru64/FreeBSD:
> |     ----------    1 crow     users           0 Jan 16 10:30 /tmp/foobar
> | 
> | I'm not sure what the result supposed to be. Any ideas ?
> 
> If you want the exact same results on each system and if you
> want the file to have the mode you set, you need to put two
> additional system calls *before* the open(2) call:
> 
>     unlink("/tmp/foobar");
>     umask(0);
> 
> If the file exists, the mode in the open() won't affect it and
> it will retain whatever it already had, so you need to ensure
> that it's not there first.  If your umask setting masks the
> group write bit, it won't be set unless you first clear the
> umask setting.
> 
> Now go and read about Unix programming.
> 
> To Unsubscribe: send mail to [EMAIL PROTECTED]
> with "unsubscribe freebsd-hackers" in the body of the message
> 


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to