summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Momjian2014-01-10 23:03:28 +0000
committerBruce Momjian2014-01-10 23:03:28 +0000
commit111022eac64579cc12d20e33146ce01717562b29 (patch)
treeb09e0eef58f48860ca2e97a10ca6f9260f4fb706
parent423e1211a86df0d0dd8914223137edbfd4d52400 (diff)
Move username lookup functions from /port to /common
Per suggestion from Peter E and Alvaro
-rw-r--r--src/backend/libpq/auth.c1
-rw-r--r--src/backend/main/main.c1
-rw-r--r--src/bin/initdb/initdb.c1
-rw-r--r--src/bin/psql/help.c1
-rw-r--r--src/bin/scripts/common.h1
-rw-r--r--src/common/Makefile2
-rw-r--r--src/common/username.c (renamed from src/port/username.c)3
-rw-r--r--src/include/common/username.h15
-rw-r--r--src/include/port.h4
-rw-r--r--src/port/Makefile2
-rw-r--r--src/tools/msvc/Mkvcbuild.pm4
11 files changed, 26 insertions, 9 deletions
diff --git a/src/backend/libpq/auth.c b/src/backend/libpq/auth.c
index 72ee9cc698..8589915984 100644
--- a/src/backend/libpq/auth.c
+++ b/src/backend/libpq/auth.c
@@ -21,6 +21,7 @@
#include <arpa/inet.h>
#include <unistd.h>
+#include "common/username.h"
#include "libpq/auth.h"
#include "libpq/crypt.h"
#include "libpq/ip.h"
diff --git a/src/backend/main/main.c b/src/backend/main/main.c
index a046c1cf0f..4ee8a153d9 100644
--- a/src/backend/main/main.c
+++ b/src/backend/main/main.c
@@ -35,6 +35,7 @@
#endif
#include "bootstrap/bootstrap.h"
+#include "common/username.h"
#include "postmaster/postmaster.h"
#include "tcop/tcopprot.h"
#include "utils/help_config.h"
diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c
index 3f1ce05674..a9aa7a487f 100644
--- a/src/bin/initdb/initdb.c
+++ b/src/bin/initdb/initdb.c
@@ -60,6 +60,7 @@
#include "sys/mman.h"
#endif
+#include "common/username.h"
#include "mb/pg_wchar.h"
#include "getaddrinfo.h"
#include "getopt_long.h"
diff --git a/src/bin/psql/help.c b/src/bin/psql/help.c
index d7c31e0b1b..baa94175ea 100644
--- a/src/bin/psql/help.c
+++ b/src/bin/psql/help.c
@@ -23,6 +23,7 @@
#endif
#include "common.h"
+#include "common/username.h"
#include "help.h"
#include "input.h"
#include "settings.h"
diff --git a/src/bin/scripts/common.h b/src/bin/scripts/common.h
index 4944c46a4b..691f6c6a02 100644
--- a/src/bin/scripts/common.h
+++ b/src/bin/scripts/common.h
@@ -9,6 +9,7 @@
#ifndef COMMON_H
#define COMMON_H
+#include "common/username.h"
#include "libpq-fe.h"
#include "getopt_long.h" /* pgrminclude ignore */
#include "pqexpbuffer.h" /* pgrminclude ignore */
diff --git a/src/common/Makefile b/src/common/Makefile
index 62ca8ab0c3..7edbaaa2c1 100644
--- a/src/common/Makefile
+++ b/src/common/Makefile
@@ -23,7 +23,7 @@ include $(top_builddir)/src/Makefile.global
override CPPFLAGS := -DFRONTEND $(CPPFLAGS)
LIBS += $(PTHREAD_LIBS)
-OBJS_COMMON = exec.o pgfnames.o psprintf.o relpath.o rmtree.o wait_error.o
+OBJS_COMMON = exec.o pgfnames.o psprintf.o relpath.o rmtree.o username.o wait_error.o
OBJS_FRONTEND = $(OBJS_COMMON) fe_memutils.o
diff --git a/src/port/username.c b/src/common/username.c
index f0f0a8900d..c6812ddd9d 100644
--- a/src/port/username.c
+++ b/src/common/username.c
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * src/port/username.c
+ * src/common/username.c
*
*-------------------------------------------------------------------------
*/
@@ -23,6 +23,7 @@
#include <unistd.h>
#include <sys/types.h>
+#include "common/username.h"
/*
* Returns the current user name in a static buffer, or NULL on error and
diff --git a/src/include/common/username.h b/src/include/common/username.h
new file mode 100644
index 0000000000..115d1ed450
--- /dev/null
+++ b/src/include/common/username.h
@@ -0,0 +1,15 @@
+/*
+ * username.h
+ * lookup effective username
+ *
+ * Copyright (c) 2003-2014, PostgreSQL Global Development Group
+ *
+ * src/include/common/username.h
+ */
+#ifndef USERNAME_H
+#define USERNAME_H
+
+extern const char *get_user_name(char **errstr);
+extern const char *get_user_name_or_exit(const char *progname);
+
+#endif /* USERNAME_H */
diff --git a/src/include/port.h b/src/include/port.h
index bc275c0c1c..f50fbecf01 100644
--- a/src/include/port.h
+++ b/src/include/port.h
@@ -473,10 +473,6 @@ extern pqsigfunc pqsignal(int signo, pqsigfunc func);
/* port/quotes.c */
extern char *escape_single_quotes_ascii(const char *src);
-/* port/username.c */
-extern const char *get_user_name(char **errstr);
-extern const char *get_user_name_or_exit(const char *progname);
-
/* port/wait_error.c */
extern char *wait_result_to_str(int exit_status);
diff --git a/src/port/Makefile b/src/port/Makefile
index a50e0af214..1be4ff57a2 100644
--- a/src/port/Makefile
+++ b/src/port/Makefile
@@ -33,7 +33,7 @@ LIBS += $(PTHREAD_LIBS)
OBJS = $(LIBOBJS) chklocale.o dirmod.o erand48.o fls.o inet_net_ntop.o \
noblock.o path.o pgcheckdir.o pg_crc.o pgmkdirp.o pgsleep.o \
pgstrcasecmp.o pqsignal.o \
- qsort.o qsort_arg.o quotes.o sprompt.o tar.o thread.o username.o
+ qsort.o qsort_arg.o quotes.o sprompt.o tar.o thread.o
# foo_srv.o and foo.o are both built from foo.c, but only foo.o has -DFRONTEND
OBJS_SRV = $(OBJS:%.o=%_srv.o)
diff --git a/src/tools/msvc/Mkvcbuild.pm b/src/tools/msvc/Mkvcbuild.pm
index d6b6eaf158..a8324ff7b2 100644
--- a/src/tools/msvc/Mkvcbuild.pm
+++ b/src/tools/msvc/Mkvcbuild.pm
@@ -70,11 +70,11 @@ sub mkvcbuild
erand48.c snprintf.c strlcat.c strlcpy.c dirmod.c noblock.c path.c
pgcheckdir.c pg_crc.c pgmkdirp.c pgsleep.c pgstrcasecmp.c pqsignal.c
qsort.c qsort_arg.c quotes.c
- sprompt.c tar.c thread.c getopt.c getopt_long.c dirent.c rint.c username.c
+ sprompt.c tar.c thread.c getopt.c getopt_long.c dirent.c rint.c
win32env.c win32error.c win32setlocale.c);
our @pgcommonallfiles = qw(
- exec.c pgfnames.c psprintf.c relpath.c rmtree.c wait_error.c);
+ exec.c pgfnames.c psprintf.c relpath.c rmtree.c username.c wait_error.c);
our @pgcommonfrontendfiles = (@pgcommonallfiles, qw(fe_memutils.c));