diff options
author | Bruce Momjian <bruce@momjian.us> | 1997-11-02 18:15:20 +0000 |
---|---|---|
committer | Bruce Momjian <bruce@momjian.us> | 1997-11-02 18:15:20 +0000 |
commit | 89ad3270993087b162031af34d67a29686a9bf01 (patch) | |
tree | c399f44a13b53e7f476f96a6a5e1988dcc3dbc5d /src | |
parent | 32cd09ac6d467ec788f8f4181097d47bafcfaee1 (diff) | |
download | postgresql-89ad3270993087b162031af34d67a29686a9bf01.tar.gz postgresql-89ad3270993087b162031af34d67a29686a9bf01.zip |
Portability fix for pg_passwd.
Diffstat (limited to 'src')
-rw-r--r-- | src/bin/pg_passwd/pg_passwd.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/bin/pg_passwd/pg_passwd.c b/src/bin/pg_passwd/pg_passwd.c index a4fd49782d9..682e07eb338 100644 --- a/src/bin/pg_passwd/pg_passwd.c +++ b/src/bin/pg_passwd/pg_passwd.c @@ -8,7 +8,7 @@ #include <strings.h> #include <unistd.h> #include <errno.h> -#include <sys/time.h> +#include <time.h> #include <ctype.h> #define issaltchar(c) (isalnum(c) || (c) == '.' || (c) == '/') @@ -111,7 +111,7 @@ try_again: /* get user name */ p = line; - if ((q = index(p, ':')) == NULL) + if ((q = strchr(p, ':')) == NULL) { fprintf(stderr, "%s: line %d: illegal format.\n", filename, npwds + 1); @@ -138,10 +138,10 @@ try_again: /* get password field */ p = q; - q = index(p, ':'); + q = strchr(p, ':'); /* - * --- don't care ----- if ((q = index(p, ':')) == NULL) { + * --- don't care ----- if ((q = strchr(p, ':')) == NULL) { * fprintf(stderr, "%s: line %d: illegal format.\n", filename, * npwds + 1); exit(1); } */ @@ -215,10 +215,7 @@ encrypt_pwd(char key[9], char salt[3], char passwd[14]) /* get encrypted password */ if (salt[0] == '\0') { - struct timeval tm; - - gettimeofday(&tm, NULL); - srand(tm.tv_sec ? tm.tv_sec : 1); + srand(time(NULL)); do { n = rand() % 256; |