Thread: finding user permissions

  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 int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    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.

  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-03-2011, 12:58 AM
  2. Replies: 8
    Last Post: 12-30-2010, 10: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, 05:01 PM
  5. ~ User Input script help~
    By indy in forum C Programming
    Replies: 4
    Last Post: 12-02-2003, 06:01 AM