SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Addict delpino's Avatar
    Join Date
    Nov 2001
    Location
    London
    Posts
    335
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    when does umask(0) matter?

    Can somebody confirm what this does:

    PHP Code:

     $old 
    umask(0);
     
    chmod("/path/some_dir/some_file.txt"0755);
     
    umask($old); 
    As far as I understand it says ignore current umask, then set file to 755 and then set old umask back? Is that correct?

    However I noticed that I don't need to use umask(0), it works fine without too. Under which circumstances does this matter?
    http://www.antosch-and-lin.com - Language Learning

  2. #2
    SitePoint Addict delpino's Avatar
    Join Date
    Nov 2001
    Location
    London
    Posts
    335
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Anybody has a clue?
    http://www.antosch-and-lin.com - Language Learning

  3. #3
    SitePoint Wizard silver trophy
    Join Date
    Mar 2006
    Posts
    6,132
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i dont see the purpose of changing the umask so you can use chmod()

    chmod() doesnt use the umask, it just sets the permissions according to the value you tell it to.

    changing the umask could be useful before you for example, create a new directory or file. but this seems pretty pointless if the only purpose is to use chmod()

    you may want to read up on what a "umask" is, its specific to unix type filesystems.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •