Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitbfa5304

Browse files
committed
Remove ExpandDatabasePath(), which is unused and must have been so since
7.1, because the path interpretation it embodies has been wrong since 7.1.
1 parent58ae3cf commitbfa5304

File tree

2 files changed

+2
-88
lines changed

2 files changed

+2
-88
lines changed

‎src/backend/utils/misc/database.c

Lines changed: 1 addition & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/utils/misc/database.c,v 1.59 2003/11/29 19:52:03 pgsql Exp $
11+
* $PostgreSQL: pgsql/src/backend/utils/misc/database.c,v 1.60 2004/01/22 20:57:39 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -28,91 +28,6 @@
2828
staticboolPhonyHeapTupleSatisfiesNow(HeapTupleHeadertuple);
2929

3030

31-
/*
32-
* ExpandDatabasePath resolves a proposed database path (obtained from
33-
* pg_database.datpath) to a full absolute path for further consumption.
34-
* NULL means an error, which the caller should process. One reason for
35-
* such an error would be an absolute alternative path when no absolute
36-
* paths are allowed.
37-
*/
38-
39-
char*
40-
ExpandDatabasePath(constchar*dbpath)
41-
{
42-
charbuf[MAXPGPATH];
43-
constchar*cp;
44-
intlen;
45-
46-
AssertArg(dbpath);
47-
Assert(DataDir);
48-
49-
if (strlen(dbpath) >=MAXPGPATH)
50-
returnNULL;/* ain't gonna fit nohow */
51-
52-
/* leading path delimiter? then already absolute path */
53-
if (is_absolute_path(dbpath))
54-
{
55-
#ifdefALLOW_ABSOLUTE_DBPATHS
56-
cp=last_path_separator(dbpath);
57-
len=cp-dbpath;
58-
strncpy(buf,dbpath,len);
59-
snprintf(&buf[len],MAXPGPATH-len,"/base/%s", (cp+1));
60-
#else
61-
returnNULL;
62-
#endif
63-
}
64-
/* path delimiter somewhere? then has leading environment variable */
65-
elseif ((cp=first_path_separator(dbpath))!=NULL)
66-
{
67-
constchar*envvar;
68-
69-
len=cp-dbpath;
70-
strncpy(buf,dbpath,len);
71-
buf[len]='\0';
72-
envvar=getenv(buf);
73-
if (envvar==NULL)
74-
returnNULL;
75-
76-
snprintf(buf,sizeof(buf),"%s/base/%s",envvar, (cp+1));
77-
}
78-
else
79-
{
80-
/* no path delimiter? then add the default path prefix */
81-
snprintf(buf,sizeof(buf),"%s/base/%s",DataDir,dbpath);
82-
}
83-
84-
/*
85-
* check for illegal characters in dbpath these should really throw an
86-
* error, shouldn't they? or else all callers need to test for NULL
87-
*/
88-
for (cp=buf;*cp;cp++)
89-
{
90-
/*
91-
* The following characters will not be allowed anywhere in the
92-
* database path. (Do not include the slash or '.' here.)
93-
*/
94-
charillegal_dbpath_chars[]=
95-
"\001\002\003\004\005\006\007\010"
96-
"\011\012\013\014\015\016\017\020"
97-
"\021\022\023\024\025\026\027\030"
98-
"\031\032\033\034\035\036\037"
99-
"'`";
100-
101-
constchar*cx;
102-
103-
for (cx=illegal_dbpath_chars;*cx;cx++)
104-
if (*cp==*cx)
105-
returnNULL;
106-
/* don't allow access to parent dirs */
107-
if (strncmp(cp,"/../",4)==0)
108-
returnNULL;
109-
}
110-
111-
returnpstrdup(buf);
112-
}/* ExpandDatabasePath() */
113-
114-
115-
11631
/* --------------------------------
11732
*GetRawDatabaseInfo() -- Find the OID and path of the database.
11833
*

‎src/include/miscadmin.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
1313
* Portions Copyright (c) 1994, Regents of the University of California
1414
*
15-
* $PostgreSQL: pgsql/src/include/miscadmin.h,v 1.144 2004/01/09 23:29:31 momjian Exp $
15+
* $PostgreSQL: pgsql/src/include/miscadmin.h,v 1.145 2004/01/22 20:57:39 tgl Exp $
1616
*
1717
* NOTES
1818
* some of the information in this file should be moved to
@@ -231,7 +231,6 @@ extern char *DatabasePath;
231231

232232
/* in utils/misc/database.c */
233233
externvoidGetRawDatabaseInfo(constchar*name,Oid*db_id,char*path);
234-
externchar*ExpandDatabasePath(constchar*path);
235234

236235
/* now in utils/init/miscinit.c */
237236
externvoidSetDatabasePath(constchar*path);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp