day4(带)

int is_his_file(char*filename,char *username)

{

int ret;

struct passwd *user_info;//

struct stat stat_info;

user_info=getpwnam(username);//获取用户信息

if(user_info==NULL)

{

printf("can not find this user ");

exit(-1);

}

stat(filename,&stat_info);

if(stat_info.st_uid==user_info->pw_uid)

return 0;

else

return -1;

}

两个函数的结果返回????????????????

apue   getpwnam

lcs:http://segmentfault.com/a/1190000002641054   http://blog.chinaunix.net/uid-26548237-id-3374211.html  http://www.cnblogs.com/huangxincheng/archive/2012/11/11/2764625.html

原文地址:https://www.cnblogs.com/degrone/p/4945608.html