Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 111022e

Browse files
committed
Move username lookup functions from /port to /common
Per suggestion from Peter E and Alvaro
1 parent 423e121 commit 111022e

File tree

11 files changed

+26
-9
lines changed

11 files changed

+26
-9
lines changed

src/backend/libpq/auth.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include <arpa/inet.h>
2222
#include <unistd.h>
2323

24+
#include "common/username.h"
2425
#include "libpq/auth.h"
2526
#include "libpq/crypt.h"
2627
#include "libpq/ip.h"

src/backend/main/main.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
#endif
3636

3737
#include "bootstrap/bootstrap.h"
38+
#include "common/username.h"
3839
#include "postmaster/postmaster.h"
3940
#include "tcop/tcopprot.h"
4041
#include "utils/help_config.h"

src/bin/initdb/initdb.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
#include "sys/mman.h"
6161
#endif
6262

63+
#include "common/username.h"
6364
#include "mb/pg_wchar.h"
6465
#include "getaddrinfo.h"
6566
#include "getopt_long.h"

src/bin/psql/help.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#endif
2424

2525
#include "common.h"
26+
#include "common/username.h"
2627
#include "help.h"
2728
#include "input.h"
2829
#include "settings.h"

src/bin/scripts/common.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#ifndef COMMON_H
1010
#define COMMON_H
1111

12+
#include "common/username.h"
1213
#include "libpq-fe.h"
1314
#include "getopt_long.h" /* pgrminclude ignore */
1415
#include "pqexpbuffer.h" /* pgrminclude ignore */

src/common/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ include $(top_builddir)/src/Makefile.global
2323
override CPPFLAGS := -DFRONTEND $(CPPFLAGS)
2424
LIBS += $(PTHREAD_LIBS)
2525

26-
OBJS_COMMON = exec.o pgfnames.o psprintf.o relpath.o rmtree.o wait_error.o
26+
OBJS_COMMON = exec.o pgfnames.o psprintf.o relpath.o rmtree.o username.o wait_error.o
2727

2828
OBJS_FRONTEND = $(OBJS_COMMON) fe_memutils.o
2929

src/port/username.c renamed to src/common/username.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1994, Regents of the University of California
88
*
99
* IDENTIFICATION
10-
* src/port/username.c
10+
* src/common/username.c
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -23,6 +23,7 @@
2323
#include <unistd.h>
2424
#include <sys/types.h>
2525

26+
#include "common/username.h"
2627

2728
/*
2829
* Returns the current user name in a static buffer, or NULL on error and

src/include/common/username.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/*
2+
* username.h
3+
* lookup effective username
4+
*
5+
* Copyright (c) 2003-2014, PostgreSQL Global Development Group
6+
*
7+
* src/include/common/username.h
8+
*/
9+
#ifndef USERNAME_H
10+
#define USERNAME_H
11+
12+
extern const char *get_user_name(char **errstr);
13+
extern const char *get_user_name_or_exit(const char *progname);
14+
15+
#endif /* USERNAME_H */

src/include/port.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -473,10 +473,6 @@ extern pqsigfunc pqsignal(int signo, pqsigfunc func);
473473
/* port/quotes.c */
474474
extern char *escape_single_quotes_ascii(const char *src);
475475

476-
/* port/username.c */
477-
extern const char *get_user_name(char **errstr);
478-
extern const char *get_user_name_or_exit(const char *progname);
479-
480476
/* port/wait_error.c */
481477
extern char *wait_result_to_str(int exit_status);
482478

src/port/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ LIBS += $(PTHREAD_LIBS)
3333
OBJS = $(LIBOBJS) chklocale.o dirmod.o erand48.o fls.o inet_net_ntop.o \
3434
noblock.o path.o pgcheckdir.o pg_crc.o pgmkdirp.o pgsleep.o \
3535
pgstrcasecmp.o pqsignal.o \
36-
qsort.o qsort_arg.o quotes.o sprompt.o tar.o thread.o username.o
36+
qsort.o qsort_arg.o quotes.o sprompt.o tar.o thread.o
3737

3838
# foo_srv.o and foo.o are both built from foo.c, but only foo.o has -DFRONTEND
3939
OBJS_SRV = $(OBJS:%.o=%_srv.o)

src/tools/msvc/Mkvcbuild.pm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,11 @@ sub mkvcbuild
7070
erand48.c snprintf.c strlcat.c strlcpy.c dirmod.c noblock.c path.c
7171
pgcheckdir.c pg_crc.c pgmkdirp.c pgsleep.c pgstrcasecmp.c pqsignal.c
7272
qsort.c qsort_arg.c quotes.c
73-
sprompt.c tar.c thread.c getopt.c getopt_long.c dirent.c rint.c username.c
73+
sprompt.c tar.c thread.c getopt.c getopt_long.c dirent.c rint.c
7474
win32env.c win32error.c win32setlocale.c);
7575

7676
our @pgcommonallfiles = qw(
77-
exec.c pgfnames.c psprintf.c relpath.c rmtree.c wait_error.c);
77+
exec.c pgfnames.c psprintf.c relpath.c rmtree.c username.c wait_error.c);
7878

7979
our @pgcommonfrontendfiles = (@pgcommonallfiles, qw(fe_memutils.c));
8080

0 commit comments

Comments
 (0)