[Chicago-talk] CGI umask

Steven Lembark lembark at wrkhors.com
Wed Mar 3 13:50:39 CST 2004



-- Ed Summers <ehs at pobox.com>

> On Tue, Mar 02, 2004 at 11:04:15PM -0600, jason scott gessner wrote:
>> 	  my $old_mask = umask 000;
>>         mkdir ($gallery_base_dsk . "$gallery_name/thumbnails", 0777);
>>         umask $old_mask;
>
> Is it possible that the directory exists already? I would check the
> return of  mkdir()
>
>     mkdir($gallery_base_dsk . "$gallery_name/thumbnails", 0777) or die $!;
>
> You could try to chmod( 0777, "$gallery_name/thumbnails" ) in situations
> where the directory already exists.

Die might be a bit extreme in this case.

As a general approach, you can mkdir the new one, chmod
it to the appropriate mods, then stat it. That allows for
existing directories + ones you don't own that have the
correct mod's anyway.


--
Steven Lembark                               2930 W. Palmer
Workhorse Computing                       Chicago, IL 60647
                                            +1 888 359 3508



More information about the Chicago-talk mailing list