diff options
| author | Tom Lane <tgl@sss.pgh.pa.us> | 2005-08-02 19:02:32 +0000 |
|---|---|---|
| committer | Tom Lane <tgl@sss.pgh.pa.us> | 2005-08-02 19:02:32 +0000 |
| commit | 558730ac6bbc668a75c7a7619beae5a1b34d965f (patch) | |
| tree | d8928d1a5e9e5aefa53a6f96fd7d9237d40e872e /src/include | |
| parent | 0001e98d54f3d81c2ff413e4aec4933bd1378963 (diff) | |
Clean up CREATE DATABASE processing to make it more robust and get rid
of special case for Windows port. Put a PG_TRY around most of createdb()
to ensure that we remove copied subdirectories on failure, even if the
failure happens while creating the pg_database row. (I think this explains
Oliver Siegmar's recent report.) Having done that, there's no need for
the fragile assumption that copydir() mustn't ereport(ERROR), so simplify
its API. Eliminate the old code that used system("cp ...") to copy
subdirectories, in favor of using copydir() on all platforms. This not
only should allow much better error reporting, but allows us to fsync
the created files before trusting that the copy has succeeded.
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/port.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/include/port.h b/src/include/port.h index 76bec0a4ba6..95e5531c931 100644 --- a/src/include/port.h +++ b/src/include/port.h @@ -6,7 +6,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/port.h,v 1.79 2005/07/06 21:40:09 momjian Exp $ + * $PostgreSQL: pgsql/src/include/port.h,v 1.80 2005/08/02 19:02:32 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -206,6 +206,8 @@ extern int pgsymlink(const char *oldpath, const char *newpath); #endif /* defined(WIN32) || defined(__CYGWIN__) */ +extern void copydir(char *fromdir, char *todir, bool recurse); + extern bool rmtree(char *path, bool rmtopdir); #if defined(WIN32) && !defined(__CYGWIN__) @@ -223,8 +225,6 @@ extern int win32_open(const char *, int,...); #define pclose(a) _pclose(a) #endif -extern int copydir(char *fromdir, char *todir); - /* Missing rand functions */ extern long lrand48(void); extern void srand48(long seed); |
