Skip to content

Commit e26af97

Browse files
committed
ifdef out pqGetpwuid() because Win32 doesn't have struct passwd.
Needed for libpq builds, not just for native Win32 port, and probably for cygwin too.
1 parent cec1333 commit e26af97

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/include/port.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
77
* Portions Copyright (c) 1994, Regents of the University of California
88
*
9-
* $Id: port.h,v 1.12 2003/08/08 21:42:31 momjian Exp $
9+
* $Id: port.h,v 1.13 2003/09/05 17:43:39 momjian Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -112,8 +112,10 @@ extern void srandom(unsigned int seed);
112112
/* thread.h */
113113
extern char *pqStrerror(int errnum, char *strerrbuf, size_t buflen);
114114

115+
#ifndef WIN32
115116
extern int pqGetpwuid(uid_t uid, struct passwd * resultbuf, char *buffer,
116117
size_t buflen, struct passwd ** result);
118+
#endif
117119

118120
extern int pqGethostbyname(const char *name,
119121
struct hostent * resbuf,

src/port/thread.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
99
*
10-
* $Id: thread.c,v 1.5 2003/09/03 19:30:31 momjian Exp $
10+
* $Id: thread.c,v 1.6 2003/09/05 17:43:40 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -66,6 +66,7 @@ pqStrerror(int errnum, char *strerrbuf, size_t buflen)
6666
* Wrapper around getpwuid() or getpwuid_r() to mimic POSIX getpwuid_r()
6767
* behaviour, if it is not available or required.
6868
*/
69+
#ifndef WIN32
6970
int
7071
pqGetpwuid(uid_t uid, struct passwd *resultbuf, char *buffer,
7172
size_t buflen, struct passwd **result)
@@ -84,6 +85,7 @@ pqGetpwuid(uid_t uid, struct passwd *resultbuf, char *buffer,
8485
#endif
8586
return (*result == NULL) ? -1 : 0;
8687
}
88+
#endif
8789

8890
/*
8991
* Wrapper around gethostbyname() or gethostbyname_r() to mimic

0 commit comments

Comments
 (0)