Hi,
I'm looking at some Python code and I saw a very strange like like this:
WTF?? I've never seen 5 digits in a chmod permissions number. What exactly does 33152 mean?Code:os.chmod( filename, 33152 )
Hi,
I'm looking at some Python code and I saw a very strange like like this:
WTF?? I've never seen 5 digits in a chmod permissions number. What exactly does 33152 mean?Code:os.chmod( filename, 33152 )
"I am probably the laziest programmer on the planet, a fact with which anyone who has ever seen my code will agree." - esbo, 11/15/2008
"the internet is a scary place to be thats why i dont use it much." - billet, 03/17/2010
You probably need to convert it to octal to make sense of it - it's 100600
User rw only, and some kind of "sticky bit"
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
The 100000(octal) bit specifies "regular file." I wasn't actually aware that you could manipulate that bit via chmod(), but who knows.
Code://try //{ if (a) do { f( b); } while(1); else do { f(!b); } while(1); //}
A mode of 10xxxx means it's a regular file.
From /usr/include/linux/stat.h:
I imagine that chmod(2) only looks at the 4 least significant octal digits.Code:#define S_IFSOCK 0140000 #define S_IFLNK 0120000 #define S_IFREG 0100000 #define S_IFBLK 0060000 #define S_IFDIR 0040000 #define S_IFCHR 0020000 #define S_IFIFO 0010000