77 *
88 *
99 * IDENTIFICATION
10- * $Header: /cvsroot/pgsql/src/backend/commands/dbcommands.c,v 1.41 1999/09/24 00:24:17 tgl Exp $
10+ * $Header: /cvsroot/pgsql/src/backend/commands/dbcommands.c,v 1.42 1999/10/25 03:07:43 tgl Exp $
1111 *
1212 *-------------------------------------------------------------------------
1313 */
@@ -38,9 +38,9 @@ createdb(char *dbname, char *dbpath, int encoding, CommandDest dest)
3838{
3939 Oid db_id ;
4040 int4 user_id ;
41- char buf [512 ];
41+ char buf [MAXPGPATH + 100 ];
4242 char * lp ,
43- loc [512 ];
43+ loc [MAXPGPATH ];
4444
4545 /*
4646 * If this call returns, the database does not exist and we're allowed
@@ -56,7 +56,7 @@ createdb(char *dbname, char *dbpath, int encoding, CommandDest dest)
5656 {
5757 if (* (dbpath + strlen (dbpath ) - 1 ) == SEP_CHAR )
5858 * (dbpath + strlen (dbpath ) - 1 ) = '\0' ;
59- snprintf (loc , 512 , "%s%c%s" , dbpath , SEP_CHAR , dbname );
59+ snprintf (loc , sizeof ( loc ) , "%s%c%s" , dbpath , SEP_CHAR , dbname );
6060 }
6161 else
6262 strcpy (loc , dbname );
@@ -71,11 +71,11 @@ createdb(char *dbname, char *dbpath, int encoding, CommandDest dest)
7171 if (mkdir (lp , S_IRWXU ) != 0 )
7272 elog (ERROR , "Unable to create database directory '%s'" , lp );
7373
74- snprintf (buf , 512 , "%s %s%cbase%ctemplate1%c* %s " ,
74+ snprintf (buf , sizeof ( buf ) , "%s %s%cbase%ctemplate1%c* '%s' " ,
7575 COPY_CMD , DataDir , SEP_CHAR , SEP_CHAR , SEP_CHAR , lp );
7676 system (buf );
7777
78- snprintf (buf , 512 ,
78+ snprintf (buf , sizeof ( buf ) ,
7979 "insert into pg_database (datname, datdba, encoding, datpath)"
8080 " values ('%s', '%d', '%d', '%s');" , dbname , user_id , encoding ,
8181 loc );
@@ -89,8 +89,8 @@ destroydb(char *dbname, CommandDest dest)
8989 int4 user_id ;
9090 Oid db_id ;
9191 char * path ,
92- dbpath [MAXPGPATH + 1 ],
93- buf [MAXPGPATH + 50 ];
92+ dbpath [MAXPGPATH ],
93+ buf [MAXPGPATH + 100 ];
9494 Relation pgdbrel ;
9595 HeapScanDesc pgdbscan ;
9696 ScanKeyData key ;
@@ -233,7 +233,7 @@ check_permissions(char *command,
233233 bool use_super ;
234234 char * userName ;
235235 text * dbtext ;
236- char path [MAXPGPATH + 1 ];
236+ char path [MAXPGPATH ];
237237
238238 userName = GetPgUserName ();
239239 utup = SearchSysCacheTuple (USENAME ,
@@ -332,7 +332,7 @@ static void
332332stop_vacuum (char * dbpath , char * dbname )
333333{
334334#ifdef NOT_USED
335- char filename [MAXPGPATH + 1 ];
335+ char filename [MAXPGPATH ];
336336 FILE * fp ;
337337 int pid ;
338338
0 commit comments