Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit89ad327

Browse files
committed
Portability fix for pg_passwd.
1 parent32cd09a commit89ad327

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

‎src/bin/pg_passwd/pg_passwd.c

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#include<strings.h>
99
#include<unistd.h>
1010
#include<errno.h>
11-
#include<sys/time.h>
11+
#include<time.h>
1212
#include<ctype.h>
1313
#defineissaltchar(c)(isalnum(c) || (c) == '.' || (c) == '/')
1414

@@ -111,7 +111,7 @@ read_pwd_file(char *filename)
111111

112112
/* get user name */
113113
p=line;
114-
if ((q=index(p,':'))==NULL)
114+
if ((q=strchr(p,':'))==NULL)
115115
{
116116
fprintf(stderr,"%s: line %d: illegal format.\n",
117117
filename,npwds+1);
@@ -138,10 +138,10 @@ read_pwd_file(char *filename)
138138

139139
/* get password field */
140140
p=q;
141-
q=index(p,':');
141+
q=strchr(p,':');
142142

143143
/*
144-
* --- don't care ----- if ((q =index(p, ':')) == NULL) {
144+
* --- don't care ----- if ((q =strchr(p, ':')) == NULL) {
145145
* fprintf(stderr, "%s: line %d: illegal format.\n", filename,
146146
* npwds + 1); exit(1); }
147147
*/
@@ -215,10 +215,7 @@ encrypt_pwd(char key[9], char salt[3], char passwd[14])
215215
/* get encrypted password */
216216
if (salt[0]=='\0')
217217
{
218-
structtimevaltm;
219-
220-
gettimeofday(&tm,NULL);
221-
srand(tm.tv_sec ?tm.tv_sec :1);
218+
srand(time(NULL));
222219
do
223220
{
224221
n=rand() %256;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp