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

Commit07d4d36

Browse files
committed
On solaris, createdb/dropdb fails because of strange behavior of system().
(it returns error with errno ECHILD upon successful completion of commands).This fix ignores an error from system() if errno == ECHILD.
1 parentc439756 commit07d4d36

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

‎src/backend/commands/dbcommands.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* 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 $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -148,13 +148,21 @@ createdb(const char *dbname, const char *dbpath, int encoding)
148148

149149
snprintf(buf,sizeof(buf),"cp %s%cbase%ctemplate1%c* '%s'",
150150
DataDir,SEP_CHAR,SEP_CHAR,SEP_CHAR,loc);
151+
#if defined(sun)
152+
if (system(buf)!=0&&errno!=ECHILD)
153+
#else
151154
if (system(buf)!=0)
155+
#endif
152156
{
153157
intret;
154158

155159
snprintf(buf,sizeof(buf),"rm -rf '%s'",loc);
156160
ret=system(buf);
161+
#if defined(sun)
162+
if (ret==0||errno==ECHILD)
163+
#else
157164
if (ret==0)
165+
#endif
158166
elog(ERROR,"CREATE DATABASE: could not initialize database directory");
159167
else
160168
elog(ERROR,"CREATE DATABASE: Could not initialize database directory. Delete failed as well");
@@ -281,7 +289,11 @@ dropdb(const char *dbname)
281289
* Remove the database's subdirectory and everything in it.
282290
*/
283291
snprintf(buf,sizeof(buf),"rm -rf '%s'",path);
292+
#if defined(sun)
293+
if (system(buf)!=0&&errno!=ECHILD)
294+
#else
284295
if (system(buf)!=0)
296+
#endif
285297
elog(NOTICE,"DROP DATABASE: The database directory '%s' could not be removed",path);
286298
}
287299

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp