99 * Dec 17, 1997 - Todd A. Brandys
1010 * Orignal Version Completed.
1111 *
12- * $Id: crypt.c,v 1.28 2000/07/12 22:58:59 petere Exp $
12+ * $Id: crypt.c,v 1.29 2000/08/27 21:50:18 tgl Exp $
1313 *
1414 *-------------------------------------------------------------------------
1515 */
1616
17+ #include <errno.h>
1718#include <unistd.h>
1819
1920#include "postgres.h"
@@ -32,11 +33,10 @@ int pwd_cache_count = 0;
3233/*-------------------------------------------------------------------------*/
3334
3435char *
35- crypt_getpwdfilename ()
36+ crypt_getpwdfilename (void )
3637{
37-
38- static char * pfnam = NULL ;
3938 int bufsize ;
39+ char * pfnam ;
4040
4141 bufsize = strlen (DataDir ) + 8 + strlen (CRYPT_PWD_FILE ) + 1 ;
4242 pfnam = (char * ) palloc (bufsize );
@@ -48,12 +48,11 @@ crypt_getpwdfilename()
4848/*-------------------------------------------------------------------------*/
4949
5050char *
51- crypt_getpwdreloadfilename ()
51+ crypt_getpwdreloadfilename (void )
5252{
53-
54- static char * rpfnam = NULL ;
5553 char * pwdfilename ;
5654 int bufsize ;
55+ char * rpfnam ;
5756
5857 pwdfilename = crypt_getpwdfilename ();
5958 bufsize = strlen (pwdfilename ) + strlen (CRYPT_PWD_RELOAD_SUFX ) + 1 ;
@@ -65,23 +64,25 @@ crypt_getpwdreloadfilename()
6564
6665/*-------------------------------------------------------------------------*/
6766
68- static
69- FILE *
70- crypt_openpwdfile ()
67+ static FILE *
68+ crypt_openpwdfile (void )
7169{
7270 char * filename ;
7371 FILE * pwdfile ;
7472
7573 filename = crypt_getpwdfilename ();
7674 pwdfile = AllocateFile (filename , PG_BINARY_R );
7775
76+ if (pwdfile == NULL )
77+ fprintf (stderr , "Couldn't read %s: %s\n" ,
78+ filename , strerror (errno ));
79+
7880 return pwdfile ;
7981}
8082
8183/*-------------------------------------------------------------------------*/
8284
83- static
84- int
85+ static int
8586compar_user (const void * user_a , const void * user_b )
8687{
8788
@@ -115,9 +116,8 @@ compar_user(const void *user_a, const void *user_b)
115116
116117/*-------------------------------------------------------------------------*/
117118
118- static
119- void
120- crypt_loadpwdfile ()
119+ static void
120+ crypt_loadpwdfile (void )
121121{
122122
123123 char * filename ;
@@ -176,8 +176,7 @@ crypt_loadpwdfile()
176176
177177/*-------------------------------------------------------------------------*/
178178
179- static
180- void
179+ static void
181180crypt_parsepwdentry (char * buffer , char * * pwd , char * * valdate )
182181{
183182
@@ -212,11 +211,9 @@ crypt_parsepwdentry(char *buffer, char **pwd, char **valdate)
212211
213212/*-------------------------------------------------------------------------*/
214213
215- static
216- int
214+ static int
217215crypt_getloginfo (const char * user , char * * passwd , char * * valuntil )
218216{
219-
220217 char * pwd ,
221218 * valdate ;
222219 void * fakeout ;
0 commit comments