|
8 | 8 | *
|
9 | 9 | *
|
10 | 10 | * IDENTIFICATION
|
11 |
| - * $Header: /cvsroot/pgsql/src/backend/commands/dbcommands.c,v 1.53 2000/04/12 17:14:58 momjian Exp $ |
| 11 | + * $Header: /cvsroot/pgsql/src/backend/commands/dbcommands.c,v 1.54 2000/05/25 06:53:43 ishii Exp $ |
12 | 12 | *
|
13 | 13 | *-------------------------------------------------------------------------
|
14 | 14 | */
|
@@ -148,13 +148,21 @@ createdb(const char *dbname, const char *dbpath, int encoding)
|
148 | 148 |
|
149 | 149 | snprintf(buf, sizeof(buf), "cp %s%cbase%ctemplate1%c* '%s'",
|
150 | 150 | DataDir, SEP_CHAR, SEP_CHAR, SEP_CHAR, loc);
|
| 151 | +#if defined(sun) |
| 152 | + if (system(buf) != 0 && errno != ECHILD) |
| 153 | +#else |
151 | 154 | if (system(buf) != 0)
|
| 155 | +#endif |
152 | 156 | {
|
153 | 157 | int ret;
|
154 | 158 |
|
155 | 159 | snprintf(buf, sizeof(buf), "rm -rf '%s'", loc);
|
156 | 160 | ret = system(buf);
|
| 161 | +#if defined(sun) |
| 162 | + if (ret == 0 || errno == ECHILD) |
| 163 | +#else |
157 | 164 | if (ret == 0)
|
| 165 | +#endif |
158 | 166 | elog(ERROR, "CREATE DATABASE: could not initialize database directory");
|
159 | 167 | else
|
160 | 168 | elog(ERROR, "CREATE DATABASE: Could not initialize database directory. Delete failed as well");
|
@@ -281,7 +289,11 @@ dropdb(const char *dbname)
|
281 | 289 | * Remove the database's subdirectory and everything in it.
|
282 | 290 | */
|
283 | 291 | snprintf(buf, sizeof(buf), "rm -rf '%s'", path);
|
| 292 | +#if defined(sun) |
| 293 | + if (system(buf) != 0 && errno != ECHILD) |
| 294 | +#else |
284 | 295 | if (system(buf) != 0)
|
| 296 | +#endif |
285 | 297 | elog(NOTICE, "DROP DATABASE: The database directory '%s' could not be removed", path);
|
286 | 298 | }
|
287 | 299 |
|
|
0 commit comments