使用者工具

網站工具


freebsd:pam_mkhomedir

差異處

這裏顯示兩個版本的差異處。

連向這個比對檢視

Both sides previous revision 前次修改
freebsd:pam_mkhomedir [2007/08/25 14:16]
wenpei
freebsd:pam_mkhomedir [2008/01/28 15:37] (目前版本)
wenpei
行 8: 行 8:
 <​code>​ <​code>​
 79,80c79,80 79,80c79,80
-<       ​if (mkdir(dir, mode) != 0 && errno != EEXIST) { +<   ​if (mkdir(dir, mode) != 0 && errno != EEXIST) { 
-<               ​PAM_LOG("​mkdir(%s)",​ dir);+<       ​PAM_LOG("​mkdir(%s)",​ dir);
 --- ---
->       ​if (opendir(dir)!=NULL) { +>   ​if (opendir(dir)!=NULL) { 
->               ​/* exist */+>       ​/* exist */
 86a87,105 86a87,105
-> +>  
->               ​/* create DIR recursively */ +>       ​/* create DIR recursively */ 
->               ​int index = 0; +>       ​int index = 0; 
->               ​char *tempstr = (void*)malloc(strlen(dir));​ +>       ​char *tempstr = (void*)malloc(strlen(dir));​ 
->               ​strcpy(tempstr,​dir);​ +>       ​strcpy(tempstr,​dir);​ 
-> +>  
->               ​for (index = 1; tempstr[index] != '​\0';​ index++) { +>       ​for (index = 1; tempstr[index] != '​\0';​ index++) { 
->                       ​/* Create the new directory */ +>           ​/* Create the new directory */ 
->                       ​if ( tempstr[index] == '/'​ ) { +>           ​if ( tempstr[index] == '/'​ ) { 
->                               ​tempstr[index] = '​\0';​ +>               ​tempstr[index] = '​\0';​ 
->                               ​mkdir(tempstr,​ mode); +>               ​mkdir(tempstr,​ mode); 
->                               ​chown(tempstr,​ 0, 0); +>               ​chown(tempstr,​ 0, 0); 
->                               ​tempstr[index] = '/';​ +>               ​tempstr[index] = '/';​ 
->                       ​} +>           ​} 
->               ​} +>       ​} 
-> +>  
->               ​mkdir(dir, mode); +>       ​mkdir(dir, mode); 
->               ​free(tempstr);​ +>       ​free(tempstr);​ 
->               ​/* end of modify */+>       ​/* end of modify */
 </​code>​ </​code>​
freebsd/pam_mkhomedir.1188022591.txt.gz · 上一次變更: 2007/08/25 14:16 由 wenpei