finding user permissions

This is a discussion on finding user permissions within the C Programming forums, part of the General Programming Boards category; hi all i am trying to find out how to find out how to check if a file has root ...

  1. #1
    Registered User
    Join Date
    Mar 2010
    Posts
    85

    finding user permissions

    hi all
    i am trying to find out how to find out how to check if a file has root user privileges, if it does then the user should receive an error.
    i have so far found the stat() function where it could retrieve the uid but currently have no idea about how to implement it
    because it just returns a 0 or a -1 what would this mean? -1 root??
    help on this would be much appreciated

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,494
    stat() returns a struct containing a lot of info.
    Look at the appropriate field in the struct.
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    Registered User
    Join Date
    Mar 2010
    Posts
    85
    i see where your coming from ive done a little bit more reading
    but im failing to find a good example of the use of stat()
    i would preferably like to see the uid_t example

  4. #4
    Registered User
    Join Date
    Mar 2010
    Posts
    85
    issue is sorted thanks

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Pedometer
    By Carter70 in forum C Programming
    Replies: 4
    Last Post: 03-02-2011, 11:58 PM
  2. Replies: 8
    Last Post: 12-30-2010, 09:08 PM
  3. Replies: 3
    Last Post: 10-12-2010, 01:40 PM
  4. Need help managing user input
    By JayDiddums10 in forum C Programming
    Replies: 2
    Last Post: 11-19-2006, 04:01 PM
  5. ~ User Input script help~
    By indy in forum C Programming
    Replies: 4
    Last Post: 12-02-2003, 05:01 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21