Re: how to open a file with 666 permission

2004-09-30 Thread Gunnar Hjalmarsson
Bob Showalter wrote: I'm still struggling to think of a real-world situation where a file would _have_ to be created as rw-rw-rw- or rwxrwxrwx. There may be a need to grant more than one user write access. CGI scripts are running as the webserver user by default, and if you let e.g. sendmail start

RE: how to open a file with 666 permission

2004-09-30 Thread Bob Showalter
Gunnar Hjalmarsson wrote: > Bob Showalter wrote: > > Chris Devers wrote: > > > Maybe the program is a code generator that produces other files > > > which should be executable (I can't remember anyone doing this, > > > but there's no reason why it couldn't be reasonably be done). > > > > Fine, use

Re: how to open a file with 666 permission

2004-09-29 Thread Gunnar Hjalmarsson
Bob Showalter wrote: Chris Devers wrote: Maybe the program is a code generator that produces other files which should be executable (I can't remember anyone doing this, but there's no reason why it couldn't be reasonably be done). Fine, use creation bits of 0777. Are you saying that open FH, ">

RE: how to open a file with 666 permission

2004-09-29 Thread Chris Devers
On Wed, 29 Sep 2004, Bob Showalter wrote: > Chris Devers wrote: > > > Maybe the program is a code generator that produces other > > files which should be executable (I can't remember anyone doing this, > > but there's no reason why it couldn't be reasonably be done). > > Fine, use creation bits

RE: how to open a file with 666 permission

2004-09-29 Thread Bob Showalter
Chris Devers wrote: > On Wed, 29 Sep 2004, Bob Showalter wrote: > > > Gunnar Hjalmarsson wrote: > > > > > > If the program, for some reason, requires that a file it creates > > > has certain permissions, isn't it better to have the program set > > > those permissions? > > > > Why would the progr

RE: how to open a file with 666 permission

2004-09-29 Thread Chris Devers
On Wed, 29 Sep 2004, Bob Showalter wrote: > Gunnar Hjalmarsson wrote: > > > > If the program, for some reason, requires that a file it creates has > > certain permissions, isn't it better to have the program set those > > permissions? > > Why would the program itself require this? Perhaps the

RE: how to open a file with 666 permission

2004-09-29 Thread Chris Devers
On Wed, 29 Sep 2004 [EMAIL PROTECTED] wrote: > Thanks for the support .the following is the code I have written. > Working fine. Still not right though -- it was suggested to you that you use the $! variable in your die statement so that you get the error message, hence: do_stuff( $arg) or di

RE: how to open a file with 666 permission

2004-09-29 Thread Bob Showalter
Gunnar Hjalmarsson wrote: > Bob Showalter wrote: > > You need to set umask to 0 before creating the file. > > > > But don't do that. It's inadvisable to mess with the umask in a > > program, IMO. > > Why would that be inadvisable? The spirit of umask is to allow the user/sysadmin to control the

Re: how to open a file with 666 permission

2004-09-29 Thread Gunnar Hjalmarsson
Bob Showalter wrote: You need to set umask to 0 before creating the file. But don't do that. It's inadvisable to mess with the umask in a program, IMO. Why would that be inadvisable? If the user wants to create files as 666, let him set the umask before running your program. If the program, for som

Re: how to open a file with 666 permission

2004-09-29 Thread John W. Krahn
[EMAIL PROTECTED] wrote: Hey guys ! Thanks for the support .the following is the code I have written. Working fine. === open(LOG,">$main::TRACELOGFILE") or die "Can't open trace file $main::TRACELOGFILE"; system("chown XXX:Y $main::TRACELOGFILE"); system("chmo

RE: how to open a file with 666 permission

2004-09-29 Thread arjun.mallik
"); system("chmod 0666 $main::TRACELOGFILE"); Arjun -Original Message- From: John W. Krahn [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 29, 2004 6:16 PM To: Perl Beginners Subject: Re: how to open a file with 666 permission Bob Sh

Re: how to open a file with 666 permission

2004-09-29 Thread John W. Krahn
Bob Showalter wrote: [EMAIL PROTECTED] wrote: My requirement is to open file with 666 permissions. You need to set umask to 0 before creating the file. But don't do that. It's inadvisable to mess with the umask in a program, IMO. If the user wants to create files as 666, let him set the umask befor

Re: how to open a file with 666 permission

2004-09-29 Thread John W. Krahn
[EMAIL PROTECTED] wrote: Hai! Hello, My requirement is to open file with 666 permissions.[If fine doesn't exists it should get created ].Iam doing as below,is this ok. === sysopen(LOG,"$main::TRACELOGFILE",O_CREATE,0666) or die "Can't open trace file $main::TRACELOGFILE"; ==

RE: how to open a file with 666 permission

2004-09-29 Thread Bob Showalter
[EMAIL PROTECTED] wrote: > Hai! > My requirement is to open file with 666 permissions. You need to set umask to 0 before creating the file. But don't do that. It's inadvisable to mess with the umask in a program, IMO. If the user wants to create files as 666, let him set the umask before running