Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
898a14e1
Commit
898a14e1
authored
Mar 15, 2011
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove unused copy_dir() function from pg_upgrade.
parent
a858ca19
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
97 deletions
+0
-97
contrib/pg_upgrade/file.c
contrib/pg_upgrade/file.c
+0
-97
No files found.
contrib/pg_upgrade/file.c
View file @
898a14e1
...
...
@@ -17,9 +17,6 @@ static int copy_file(const char *fromfile, const char *tofile, bool force);
#ifdef WIN32
static
int
win32_pghardlink
(
const
char
*
src
,
const
char
*
dst
);
#endif
#ifdef NOT_USED
static
int
copy_dir
(
const
char
*
from
,
const
char
*
to
,
bool
force
);
#endif
#ifndef HAVE_SCANDIR
static
int
pg_scandir_internal
(
const
char
*
dirname
,
...
...
@@ -381,97 +378,3 @@ win32_pghardlink(const char *src, const char *dst)
return
0
;
}
#endif
#ifdef NOT_USED
/*
* copy_dir()
*
* Copies either a directory or a single file within a directory. If the
* source argument names a directory, we recursively copy that directory,
* otherwise we copy a single file.
*/
static
int
copy_dir
(
const
char
*
src
,
const
char
*
dst
,
bool
force
)
{
DIR
*
srcdir
;
struct
dirent
*
de
=
NULL
;
struct
stat
fst
;
if
(
src
==
NULL
||
dst
==
NULL
)
return
-
1
;
/*
* Try to open the source directory - if it turns out not to be a
* directory, assume that it's a file and copy that instead.
*/
if
((
srcdir
=
opendir
(
src
))
==
NULL
)
{
if
(
errno
==
ENOTDIR
)
return
copy_file
(
src
,
dst
,
true
);
return
-
1
;
}
if
(
mkdir
(
dst
,
S_IRWXU
)
!=
0
)
{
/*
* ignore directory already exist error
*/
if
(
errno
!=
EEXIST
)
return
-
1
;
}
while
((
de
=
readdir
(
srcdir
))
!=
NULL
)
{
char
src_file
[
MAXPGPATH
];
char
dest_file
[
MAXPGPATH
];
if
(
strcmp
(
de
->
d_name
,
"."
)
==
0
||
strcmp
(
de
->
d_name
,
".."
)
==
0
)
continue
;
memset
(
src_file
,
0
,
sizeof
(
src_file
));
memset
(
dest_file
,
0
,
sizeof
(
dest_file
));
snprintf
(
src_file
,
sizeof
(
src_file
),
"%s/%s"
,
src
,
de
->
d_name
);
snprintf
(
dest_file
,
sizeof
(
dest_file
),
"%s/%s"
,
dst
,
de
->
d_name
);
if
(
stat
(
src_file
,
&
fst
)
<
0
)
{
if
(
srcdir
!=
NULL
)
{
closedir
(
srcdir
);
srcdir
=
NULL
;
}
return
-
1
;
}
if
(
S_ISDIR
(
fst
.
st_mode
))
{
/* recurse to handle subdirectories */
if
(
force
)
copy_dir
(
src_file
,
dest_file
,
true
);
}
else
if
(
S_ISREG
(
fst
.
st_mode
))
{
if
((
copy_file
(
src_file
,
dest_file
,
1
))
==
-
1
)
{
if
(
srcdir
!=
NULL
)
{
closedir
(
srcdir
);
srcdir
=
NULL
;
}
return
-
1
;
}
}
}
if
(
srcdir
!=
NULL
)
{
closedir
(
srcdir
);
srcdir
=
NULL
;
}
return
1
;
}
#endif
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment