Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/interfaces/libpq/fe-auth.c
Original file line number Diff line number Diff line change
Expand Up @@ -1168,6 +1168,7 @@ char *
pg_fe_getusername(uid_t user_id, PQExpBuffer errorMessage)
{
char *result = NULL;
#if !defined(__EMSCRIPTEN__)
const char *name = NULL;

#ifdef WIN32
Expand All @@ -1191,7 +1192,9 @@ pg_fe_getusername(uid_t user_id, PQExpBuffer errorMessage)
else if (errorMessage)
appendPQExpBuffer(errorMessage, "%s\n", pwdbuf);
#endif

#else
const char *name = WASM_USERNAME;
#endif
if (name)
{
result = strdup(name);
Expand Down
10 changes: 8 additions & 2 deletions src/interfaces/libpq/fe-connect.c
Original file line number Diff line number Diff line change
Expand Up @@ -2015,6 +2015,7 @@ PQsetdbLogin(const char *pghost, const char *pgport, const char *pgoptions,
static int
connectNoDelay(PGconn *conn)
{
#if !defined(__EMSCRIPTEN__)
#ifdef TCP_NODELAY
int on = 1;

Expand All @@ -2029,7 +2030,7 @@ connectNoDelay(PGconn *conn)
return 0;
}
#endif

#endif
return 1;
}

Expand Down Expand Up @@ -2150,6 +2151,9 @@ connectFailureMessage(PGconn *conn, int errorno)
static int
useKeepalives(PGconn *conn)
{
#if defined(__EMSCRIPTEN__)
return 0;
#else
char *ep;
int val;

Expand All @@ -2159,6 +2163,7 @@ useKeepalives(PGconn *conn)
if (*ep)
return -1;
return val != 0 ? 1 : 0;
#endif
}

#ifndef WIN32
Expand Down Expand Up @@ -2385,13 +2390,14 @@ pqConnectDBStart(PGconn *conn)
* Nobody but developers should see this message, so we don't bother
* translating it.
*/
#if !defined(__EMSCRIPTEN__)
if (!pg_link_canary_is_frontend())
{
appendPQExpBufferStr(&conn->errorMessage,
"libpq is incorrectly linked to backend functions\n");
goto connect_errReturn;
}

#endif
/* Ensure our buffers are empty */
conn->inStart = conn->inCursor = conn->inEnd = 0;
conn->outCount = 0;
Expand Down
2 changes: 2 additions & 0 deletions src/interfaces/libpq/legacy-pqsignal.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
*
* libpq itself does not use this.
*/
#if !defined(__EMSCRIPTEN__)
pqsigfunc
pqsignal(int signo, pqsigfunc func)
{
Expand All @@ -53,3 +54,4 @@ pqsignal(int signo, pqsigfunc func)
return signal(signo, func);
#endif
}
#endif // __EMSCRIPTEN__