from our long-established standard.
#include <time.h>
#include <string.h>
#include <stdlib.h>
+#include <unistd.h>
#include "msql.h"
#include "libpq-fe.h"
snprintf(tbuf, BUFSIZ,
"select relname from pg_class where relkind='r' and relowner=%d",
- getuid());
+ geteuid());
if (msqlQuery(a, tbuf) > 0)
{
m = msqlStoreResult();
snprintf(tbuf, BUFSIZ,
"select relname from pg_class where relkind='i' and relowner=%d",
- getuid());
+ geteuid());
if (msqlQuery(a, tbuf) > 0)
{
m = msqlStoreResult();
*/
#if !defined(WIN32) && !defined(__CYGWIN__)
if (!S_ISREG(buf.st_mode) || (buf.st_mode & (S_IRWXG | S_IRWXO)) ||
- buf.st_uid != getuid())
+ buf.st_uid != geteuid())
ereport(FATAL,
(errcode(ERRCODE_CONFIG_FILE_ERROR),
errmsg("unsafe permissions on private key file \"%s\"",
struct passwd *pw;
- pw = getpwuid(getuid());
+ pw = getpwuid(geteuid());
#ifndef __BEOS__ /* no root check on BEOS */
- if (!geteuid()) /* 0 is root's uid */
+ if (geteuid() == 0) /* 0 is root's uid */
{
fprintf(stderr,
_("%s: cannot be run as root\n"
#include <pwd.h> /* for getpwuid() */
#endif
#include <sys/types.h> /* (ditto) */
-#include <unistd.h> /* for getuid() */
+#include <unistd.h> /* for geteuid() */
#else
#include <win32.h>
#endif
#ifndef WIN32
struct passwd *pw;
- pw = getpwuid(getuid());
+ pw = getpwuid(geteuid());
if (!pw)
{
fprintf(stderr, _("%s: could not obtain information about current user: %s\n"),
#include "postgres_fe.h"
-#include <sys/types.h>
#include <signal.h>
#include <fcntl.h>
-#include <errno.h>
#include <ctype.h>
-#include <string.h>
#include "libpq-fe.h"
#include "libpq-int.h"
}
#ifndef WIN32
if (!S_ISREG(buf.st_mode) || (buf.st_mode & 0077) ||
- buf.st_uid != getuid())
+ buf.st_uid != geteuid())
{
printfPQExpBuffer(&conn->errorMessage,
libpq_gettext("private key file \"%s\" has wrong permissions\n"),