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
09aad5a3
Commit
09aad5a3
authored
May 15, 2003
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add copydir() function because xcopy doesn't work in XP without a
window.
parent
bee0ac67
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
54 additions
and
9 deletions
+54
-9
configure
configure
+3
-2
configure.in
configure.in
+4
-3
src/backend/commands/dbcommands.c
src/backend/commands/dbcommands.c
+3
-4
src/port/copydir.c
src/port/copydir.c
+44
-0
No files found.
configure
View file @
09aad5a3
...
...
@@ -11395,8 +11395,9 @@ LIBOBJS="$LIBOBJS qsort.$ac_objext" ;;
esac
# Win32 can't to rename or unlink on an open file
case
$host_os
in
win32
*
|
mingw
*
)
LIBOBJS
=
"
$LIBOBJS
dirmod.
$ac_objext
"
;;
case
$host_os
in
mingw
*
)
LIBOBJS
=
"
$LIBOBJS
dirmod.
$ac_objext
"
LIBOBJS
=
"
$LIBOBJS
copydir.
$ac_objext
"
;;
esac
if
test
"
$with_readline
"
=
yes
;
then
...
...
configure.in
View file @
09aad5a3
dnl Process this file with autoconf to produce a configure script.
dnl $Header: /cvsroot/pgsql/configure.in,v 1.25
0 2003/05/15 16:35:2
7 momjian Exp $
dnl $Header: /cvsroot/pgsql/configure.in,v 1.25
1 2003/05/15 17:59:1
7 momjian Exp $
dnl
dnl Developers, please strive to achieve this order:
dnl
...
...
@@ -863,8 +863,9 @@ AC_LIBOBJ(qsort) ;;
esac
# Win32 can't to rename or unlink on an open file
case $host_os in win32*|mingw*)
AC_LIBOBJ(dirmod) ;;
case $host_os in mingw*)
AC_LIBOBJ(dirmod)
AC_LIBOBJ(copydir) ;;
esac
if test "$with_readline" = yes; then
...
...
src/backend/commands/dbcommands.c
View file @
09aad5a3
...
...
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/dbcommands.c,v 1.11
4 2003/05/07 03:47:08
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/dbcommands.c,v 1.11
5 2003/05/15 17:59:17
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -311,11 +311,10 @@ createdb(const CreatedbStmt *stmt)
/* Copy the template database to the new location */
#ifndef WIN32
snprintf
(
buf
,
sizeof
(
buf
),
"cp -r '%s' '%s'"
,
src_loc
,
target_dir
);
if
(
system
(
buf
)
!=
0
)
#else
snprintf
(
buf
,
sizeof
(
buf
),
"xcopy /e /i /q '%s' '%s'"
,
src_loc
,
target_dir
);
if
(
copydir
(
src_loc
,
target_dir
)
!=
0
)
#endif
if
(
system
(
buf
)
!=
0
)
{
if
(
remove_dbdirs
(
nominal_loc
,
alt_loc
))
elog
(
ERROR
,
"CREATE DATABASE: could not initialize database directory"
);
...
...
src/port/copydir.c
0 → 100644
View file @
09aad5a3
/*
* While "xcopy /e /i /q" works fine for copying directories, on Windows XP
* it requires an Window handle which prevents it from working when invoked
* as a service.
*/
#include "postgres.h"
int
copydir
(
char
*
fromdir
,
char
*
todir
)
{
DIR
*
xldir
;
struct
dirent
*
xlde
;
char
fromfl
[
MAXPGPATH
];
char
tofl
[
MAXPGPATH
];
if
(
mkdir
(
todir
)
!=
0
)
{
elog
(
ERROR
,
"could not make directory '%s'"
,
todir
);
return
1
;
}
xldir
=
opendir
(
fromdir
);
if
(
xldir
==
NULL
)
{
closedir
(
xldir
);
elog
(
ERROR
,
"could not open directory '%s'"
,
fromdir
);
return
1
;
}
while
((
xlde
=
readdir
(
xldir
))
!=
NULL
)
{
snprintf
(
fromfl
,
MAXPGPATH
,
"%s/%s"
,
fromdir
,
xlde
->
d_name
);
snprintf
(
tofl
,
MAXPGPATH
,
"%s/%s"
,
todir
,
xlde
->
d_name
);
if
(
CopyFile
(
fromfl
,
tofl
,
TRUE
)
<
0
)
{
closedir
(
xldir
);
elog
(
ERROR
,
"could not create file %s
\n
"
,
todir
);
return
1
;
}
}
closedir
(
xldir
);
return
0
;
}
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