Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
postgres-lambda-diff
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jakob Huber
postgres-lambda-diff
Commits
ff0b706b
Commit
ff0b706b
authored
20 years ago
by
Tom Lane
Browse files
Options
Downloads
Patches
Plain Diff
Fix random breakage in exec.c for platforms where strdup is a macro.
parent
79c3bf49
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/include/port.h
+2
-2
2 additions, 2 deletions
src/include/port.h
src/port/exec.c
+19
-19
19 additions, 19 deletions
src/port/exec.c
with
21 additions
and
21 deletions
src/include/port.h
+
2
−
2
View file @
ff0b706b
...
...
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/include/port.h,v 1.3
6
2004/05/21
05:08:03
tgl Exp $
* $PostgreSQL: pgsql/src/include/port.h,v 1.3
7
2004/05/21
16:06:22
tgl Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -60,7 +60,7 @@ extern void get_pkglib_path(const char *my_exec_path, char *ret_path);
/* Portable way to find binaries */
extern
int
find_my_exec
(
const
char
*
argv0
,
char
*
retpath
);
extern
int
find_other_exec
(
const
char
*
argv0
,
c
har
const
*
target
,
extern
int
find_other_exec
(
const
char
*
argv0
,
c
onst
char
*
target
,
const
char
*
versionstr
,
char
*
retpath
);
#if defined(__CYGWIN__) || defined(WIN32)
#define EXE ".exe"
...
...
This diff is collapsed.
Click to expand it.
src/port/exec.c
+
19
−
19
View file @
ff0b706b
...
...
@@ -7,16 +7,13 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/port/exec.c,v 1.1
2
2004/05/2
0
1
5:38:11 momjian
Exp $
* $PostgreSQL: pgsql/src/port/exec.c,v 1.1
3
2004/05/2
1
1
6:06:23 tgl
Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef FRONTEND
#include
"postgres.h"
#define malloc(l) palloc(l)
#define free(p) pfree(p)
#define strdup(p) pstrdup(p)
#else
#include
"postgres_fe.h"
#endif
...
...
@@ -24,13 +21,18 @@
#include
<grp.h>
#include
<pwd.h>
#include
<sys/stat.h>
#include
<sys/wait.h>
#include
<unistd.h>
#include
<sys/wait
.h
>
#include
"miscadmin
.h
"
#define _(x) gettext(
(
x)
)
#define _(x) gettext(x)
#include
"miscadmin.h"
#ifdef FRONTEND
#undef pstrdup
#define pstrdup(p) strdup(p)
#define pfree(p) free(p)
#endif
/* $PATH (or %PATH%) path separator */
#ifdef WIN32
...
...
@@ -58,8 +60,10 @@
#define log_error(str, param) fprintf(stderr, (str), (param))
#endif
static
void
win32_make_absolute
(
char
*
path
);
/*
* validate_exec -- validate "path" as an executable file
*
...
...
@@ -243,7 +247,7 @@ find_my_exec(const char *argv0, char *retpath)
*/
if
((
p
=
getenv
(
"PATH"
))
&&
*
p
)
{
path
=
strdup
(
p
);
/* make a modifiable copy */
path
=
p
strdup
(
p
);
/* make a modifiable copy */
for
(
startp
=
path
,
endp
=
strchr
(
path
,
PATHSEP
);
startp
&&
*
startp
;
startp
=
endp
+
1
,
endp
=
strchr
(
startp
,
PATHSEP
))
...
...
@@ -263,19 +267,19 @@ find_my_exec(const char *argv0, char *retpath)
{
case
0
:
/* found ok */
win32_make_absolute
(
retpath
);
free
(
path
);
p
free
(
path
);
return
0
;
case
-
1
:
/* wasn't even a candidate, keep looking */
break
;
case
-
2
:
/* found but disqualified */
log_error
(
"could not read binary
\"
%s
\"
"
,
retpath
);
free
(
path
);
p
free
(
path
);
return
-
1
;
}
if
(
!
endp
)
/* last one */
break
;
}
free
(
path
);
p
free
(
path
);
}
log_error
(
"could not find a
\"
%s
\"
to execute"
,
argv0
);
...
...
@@ -296,8 +300,9 @@ find_my_exec(const char *argv0, char *retpath)
* Find our binary directory, then make sure the "target" executable
* is the proper version.
*/
int
find_other_exec
(
const
char
*
argv0
,
char
const
*
target
,
const
char
*
versionstr
,
char
*
retpath
)
int
find_other_exec
(
const
char
*
argv0
,
const
char
*
target
,
const
char
*
versionstr
,
char
*
retpath
)
{
char
cmd
[
MAXPGPATH
];
char
line
[
100
];
...
...
@@ -380,8 +385,6 @@ pclose_check(FILE *stream)
/*
* Windows doesn't like relative paths to executables (other things work fine)
* so we call its builtin function to expand them. Elsewhere this is a NOOP
*
* Returns malloc'ed memory.
*/
static
void
win32_make_absolute
(
char
*
path
)
...
...
@@ -391,14 +394,11 @@ win32_make_absolute(char *path)
if
(
_fullpath
(
abspath
,
path
,
MAXPGPATH
)
==
NULL
)
{
log_error
(
"Win32 path expansion failed:
%s"
,
strerror
(
errno
));
log_error
(
"Win32 path expansion failed: %s"
,
strerror
(
errno
));
StrNCpy
(
abspath
,
path
,
MAXPGPATH
);
}
canonicalize_path
(
abspath
);
StrNCpy
(
path
,
abspath
,
MAXPGPATH
);
#endif
return
;
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment