Index: pw_util.c =================================================================== --- pw_util.c (révision 242319) +++ pw_util.c (copie de travail) @@ -96,7 +96,6 @@ #if 0 struct rlimit rlim; #endif - struct stat st; if (dir == NULL) { strcpy(passwd_dir, _PATH_ETC); @@ -124,14 +123,6 @@ strcpy(masterpasswd, master); } - if (stat(masterpasswd, &st) == -1) - return (-1); - - if (S_ISDIR(st.st_mode)) { - errno = EISDIR; - return (-1); - } - /* * The code that follows is extremely disruptive to the calling * process, and is therefore disabled until someone can conceive @@ -207,6 +198,14 @@ */ if (fstat(lockfd, &st) == -1) err(1, "fstat() failed: "); + + if (S_ISDIR(st.st_mode)) { + close(lockfd); + lockfd = -1; + errno = EISDIR; + break; + } + if (st.st_nlink != 0) break; close(lockfd); Index: gr_util.c =================================================================== --- gr_util.c (révision 242319) +++ gr_util.c (copie de travail) @@ -63,8 +63,6 @@ int gr_init(const char *dir, const char *group) { - struct stat st; - if (dir == NULL) { strcpy(group_dir, _PATH_ETC); } else { @@ -91,14 +89,6 @@ strcpy(group_file, group); } - if (stat(group_file, &st) == -1) - return (-1); - - if (S_ISDIR(st.st_mode)) { - errno = EISDIR; - return (-1); - } - initialized = 1; return (0); } @@ -127,6 +117,12 @@ } if (fstat(lockfd, &st) == -1) err(1, "fstat() failed: "); + if (S_ISDIR(st.st_mode)) { + close(lockfd); + lockfd = -1; + errno = EISDIR; + break; + } if (st.st_nlink != 0) break; close(lockfd);