Skip to content

Commit ecc198b

Browse files
committed
Re-add elog() to exec.c, per Tom.
1 parent ba71d82 commit ecc198b

File tree

5 files changed

+45
-22
lines changed

5 files changed

+45
-22
lines changed

src/bin/initdb/Makefile

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
66
# Portions Copyright (c) 1994, Regents of the University of California
77
#
8-
# $PostgreSQL: pgsql/src/bin/initdb/Makefile,v 1.39 2004/05/18 20:18:58 momjian Exp $
8+
# $PostgreSQL: pgsql/src/bin/initdb/Makefile,v 1.40 2004/05/19 17:15:20 momjian Exp $
99
#
1010
#-------------------------------------------------------------------------
1111

@@ -15,13 +15,17 @@ include $(top_builddir)/src/Makefile.global
1515

1616
override CPPFLAGS := -DFRONTEND -I$(libpq_srcdir) $(CPPFLAGS)
1717

18-
OBJS= initdb.o
18+
OBJS= initdb.o \
19+
$(filter exec.o, $(LIBOBJS))
1920

2021
all: submake-libpq submake-libpgport initdb
2122

2223
initdb: $(OBJS) $(libpq_builddir)/libpq.a
2324
$(CC) $(CFLAGS) $(OBJS) $(libpq) $(LDFLAGS) $(LIBS) -o $@$(X)
2425

26+
exec.c: % : $(top_srcdir)/src/port/%
27+
rm -f $@ && $(LN_S) $< .
28+
2529
install: all installdirs
2630
$(INSTALL_PROGRAM) initdb$(X) $(DESTDIR)$(bindir)/initdb$(X)
2731

@@ -32,7 +36,7 @@ uninstall:
3236
rm -f $(DESTDIR)$(bindir)/initdb$(X)
3337

3438
clean distclean maintainer-clean:
35-
rm -f initdb$(X) $(OBJS)
39+
rm -f initdb$(X) $(OBJS) exec.c
3640

3741

3842
# ensure that changes in datadir propagate into object file

src/bin/pg_dump/Makefile

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
66
# Portions Copyright (c) 1994, Regents of the University of California
77
#
8-
# $PostgreSQL: pgsql/src/bin/pg_dump/Makefile,v 1.48 2004/05/18 20:18:58 momjian Exp $
8+
# $PostgreSQL: pgsql/src/bin/pg_dump/Makefile,v 1.49 2004/05/19 17:15:20 momjian Exp $
99
#
1010
#-------------------------------------------------------------------------
1111

@@ -18,6 +18,7 @@ override CPPFLAGS += -DFRONTEND
1818
OBJS= pg_backup_archiver.o pg_backup_db.o pg_backup_custom.o \
1919
pg_backup_files.o pg_backup_null.o pg_backup_tar.o \
2020
dumputils.o
21+
PG_DUMPALL_OBJS = $(filter exec.o, $(LIBOBJS))
2122

2223
EXTRA_OBJS = $(top_builddir)/src/backend/parser/keywords.o
2324

@@ -32,8 +33,11 @@ pg_dump: pg_dump.o common.o pg_dump_sort.o $(OBJS) $(libpq_builddir)/libpq.a
3233
pg_restore: pg_restore.o $(OBJS) $(libpq_builddir)/libpq.a
3334
$(CC) $(CFLAGS) pg_restore.o $(OBJS) $(EXTRA_OBJS) $(libpq) $(LDFLAGS) $(LIBS) -o $@$(X)
3435

35-
pg_dumpall: pg_dumpall.o dumputils.o $(libpq_builddir)/libpq.a
36-
$(CC) $(CFLAGS) pg_dumpall.o dumputils.o $(EXTRA_OBJS) $(libpq) $(LDFLAGS) $(LIBS) -o $@$(X)
36+
pg_dumpall: pg_dumpall.o dumputils.o $(PG_DUMPALL_OBJS) $(libpq_builddir)/libpq.a
37+
$(CC) $(CFLAGS) pg_dumpall.o dumputils.o $(PG_DUMPALL_OBJS) $(EXTRA_OBJS) $(libpq) $(LDFLAGS) $(LIBS) -o $@$(X)
38+
39+
exec.c: % : $(top_srcdir)/src/port/%
40+
rm -f $@ && $(LN_S) $< .
3741

3842
.PHONY: submake-backend
3943
submake-backend:
@@ -52,4 +56,4 @@ uninstall:
5256
rm -f $(addprefix $(DESTDIR)$(bindir)/, pg_dump$(X) pg_restore$(X) pg_dumpall$(X))
5357

5458
clean distclean maintainer-clean:
55-
rm -f pg_dump$(X) pg_restore$(X) pg_dumpall$(X) $(OBJS) pg_dump.o common.o pg_dump_sort.o pg_restore.o pg_dumpall.o
59+
rm -f pg_dump$(X) pg_restore$(X) pg_dumpall$(X) $(OBJS) pg_dump.o common.o pg_dump_sort.o pg_restore.o pg_dumpall.o exec.c

src/bin/psql/Makefile

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
66
# Portions Copyright (c) 1994, Regents of the University of California
77
#
8-
# $PostgreSQL: pgsql/src/bin/psql/Makefile,v 1.45 2004/05/18 20:18:58 momjian Exp $
8+
# $PostgreSQL: pgsql/src/bin/psql/Makefile,v 1.46 2004/05/19 17:15:21 momjian Exp $
99
#
1010
#-------------------------------------------------------------------------
1111

@@ -19,7 +19,8 @@ override CPPFLAGS := -I$(libpq_srcdir) $(CPPFLAGS) -DFRONTEND
1919

2020
OBJS= command.o common.o help.o input.o stringutils.o mainloop.o copy.o \
2121
startup.o prompt.o variables.o large_obj.o print.o describe.o \
22-
psqlscan.o tab-complete.o mbprint.o
22+
psqlscan.o tab-complete.o mbprint.o \
23+
$(filter exec.o, $(LIBOBJS))
2324

2425
FLEXFLAGS = -Cfe
2526

@@ -29,6 +30,9 @@ all: submake-libpq submake-libpgport psql
2930
psql: $(OBJS) $(libpq_builddir)/libpq.a
3031
$(CC) $(CFLAGS) $(OBJS) $(libpq) $(LDFLAGS) $(LIBS) -o $@$(X)
3132

33+
exec.c: % : $(top_srcdir)/src/port/%
34+
rm -f $@ && $(LN_S) $< .
35+
3236
help.o: $(srcdir)/sql_help.h
3337

3438
ifdef PERL
@@ -60,7 +64,7 @@ uninstall:
6064

6165
# psqlscan.c is in the distribution tarball, so is not cleaned here
6266
clean distclean:
63-
rm -f psql$(X) $(OBJS)
67+
rm -f psql$(X) $(OBJS) exec.c
6468

6569
maintainer-clean: distclean
6670
rm -f $(srcdir)/sql_help.h $(srcdir)/psqlscan.c

src/interfaces/ecpg/preproc/Makefile

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/Makefile,v 1.105 2004/05/18 20:18:58 momjian Exp $
1+
# $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/Makefile,v 1.106 2004/05/19 17:15:21 momjian Exp $
22

33
subdir = src/interfaces/ecpg/preproc
44
top_builddir = ../../../..
@@ -19,13 +19,17 @@ endif
1919
override CFLAGS += $(PTHREAD_CFLAGS)
2020

2121
OBJS= preproc.o type.o ecpg.o ecpg_keywords.o output.o\
22-
keywords.o c_keywords.o ../ecpglib/typename.o descriptor.o variable.o
22+
keywords.o c_keywords.o ../ecpglib/typename.o descriptor.o variable.o \
23+
$(filter exec.o, $(LIBOBJS))
2324

2425
all: submake-libpgport ecpg
2526

2627
ecpg: $(OBJS)
2728
$(CC) $(CFLAGS) $(LDFLAGS) $^ $(LIBS) $(PTHREAD_LIBS) -o $@$(X)
2829

30+
exec.c: % : $(top_srcdir)/src/port/%
31+
rm -f $@ && $(LN_S) $< .
32+
2933
# pgc is compiled as part of preproc
3034
preproc.o: $(srcdir)/pgc.c
3135

@@ -62,7 +66,7 @@ uninstall:
6266
rm -f $(DESTDIR)$(bindir)/ecpg$(X)
6367

6468
clean distclean:
65-
rm -f *.o ecpg$(X)
69+
rm -f *.o ecpg$(X) exec.c
6670
# garbage from partial builds
6771
@rm -f y.tab.c y.tab.h
6872
# garbage from development

src/port/exec.c

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $PostgreSQL: pgsql/src/port/exec.c,v 1.9 2004/05/19 04:36:33 momjian Exp $
10+
* $PostgreSQL: pgsql/src/port/exec.c,v 1.10 2004/05/19 17:15:21 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -48,6 +48,13 @@
4848
#define S_IXOTH ((S_IXUSR)>>6)
4949
#endif
5050

51+
#ifndef FRONTEND
52+
/* We use only 3-parameter elog calls in this file, for simplicity */
53+
#define log_error(str, param) elog(LOG, (str), (param))
54+
#else
55+
#define log_error(str, param) fprintf(stderr, (str), (param))
56+
#endif
57+
5158
static void win32_make_absolute(char *path);
5259

5360
/*
@@ -192,7 +199,7 @@ find_my_exec(const char *argv0, char *full_path)
192199
{
193200
if (*++p == '\0')
194201
{
195-
fprintf(stderr, "argv[0] ends with a path separator \"%s\"", argv0);
202+
log_error("argv[0] ends with a path separator \"%s\"", argv0);
196203
return -1;
197204
}
198205
if (is_absolute_path(argv0) || !getcwd(buf, MAXPGPATH))
@@ -208,7 +215,7 @@ find_my_exec(const char *argv0, char *full_path)
208215
}
209216
else
210217
{
211-
fprintf(stderr, "invalid binary \"%s\"", buf);
218+
log_error("invalid binary \"%s\"", buf);
212219
return -1;
213220
}
214221
}
@@ -245,7 +252,7 @@ find_my_exec(const char *argv0, char *full_path)
245252
case -1: /* wasn't even a candidate, keep looking */
246253
break;
247254
case -2: /* found but disqualified */
248-
fprintf(stderr, "could not read binary \"%s\"", buf);
255+
log_error("could not read binary \"%s\"", buf);
249256
free(path);
250257
return -1;
251258
}
@@ -255,7 +262,7 @@ find_my_exec(const char *argv0, char *full_path)
255262
free(path);
256263
}
257264

258-
fprintf(stderr, "could not find a \"%s\" to execute", argv0);
265+
log_error("could not find a \"%s\" to execute", argv0);
259266
return -1;
260267

261268
#if 0
@@ -337,17 +344,17 @@ pclose_check(FILE *stream)
337344
}
338345
else if (WIFEXITED(exitstatus))
339346
{
340-
fprintf(stderr, _("child process exited with exit code %d\n"),
347+
log_error(_("child process exited with exit code %d\n"),
341348
WEXITSTATUS(exitstatus));
342349
}
343350
else if (WIFSIGNALED(exitstatus))
344351
{
345-
fprintf(stderr, _("child process was terminated by signal %d\n"),
352+
log_error(_("child process was terminated by signal %d\n"),
346353
WTERMSIG(exitstatus));
347354
}
348355
else
349356
{
350-
fprintf(stderr, _("child process exited with unrecognized status %d\n"),
357+
log_error(_("child process exited with unrecognized status %d\n"),
351358
exitstatus);
352359
}
353360

@@ -369,7 +376,7 @@ win32_make_absolute(char *path)
369376

370377
if (_fullpath(abspath, path, MAXPGPATH) == NULL)
371378
{
372-
fprintf(stderr, "Win32 path expansion failed: %s", strerror(errno));
379+
log_error("Win32 path expansion failed: %s", strerror(errno));
373380
StrNCpy(abspath, path, MAXPGPATH);
374381
}
375382
canonicalize_path(abspath);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy