Skip to contentSkip to conversation

Getting the "file struct" problem.

DISCUSSION authn 1 participant 1 message Aug 17, 2004

lore
Share & tools
lore

authn

author
#0 lore raw

Hello,
I need to have a uid of an owner of a some file. And i do like:

struct file *filep;

filep=filp_open(filename, 0, 0);
        if (IS_ERR(filep))
                return -EIO;

And then i just follow by filep->f_dentry->d_inode->i_uid. But this solution doesnt work in all cases. The case where it doesnt work is a file with permissions like /bin/su
-rws--x--x 1 root bin 35780 Jun 21 21:20 /bin/su*
Where read permission has only root. Then i got I/O error. How to solve it ? Maybe there is some other way to get the dentry struct of a file?

Signature · 2 lines
Regards
apacz