aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/init
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/utils/init')
-rw-r--r--src/backend/utils/init/findbe.c9
-rw-r--r--src/backend/utils/init/miscinit.c94
-rw-r--r--src/backend/utils/init/postinit.c28
3 files changed, 67 insertions, 64 deletions
diff --git a/src/backend/utils/init/findbe.c b/src/backend/utils/init/findbe.c
index a725160ee6b..8eb0a7954dd 100644
--- a/src/backend/utils/init/findbe.c
+++ b/src/backend/utils/init/findbe.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/init/Attic/findbe.c,v 1.35 2003/07/25 20:17:52 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/init/Attic/findbe.c,v 1.36 2003/08/04 00:43:26 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -44,6 +44,7 @@ static int
ValidateBinary(char *path)
{
struct stat buf;
+
#ifndef WIN32
uid_t euid;
struct group *gp;
@@ -85,9 +86,9 @@ ValidateBinary(char *path)
* dynamic loading).
*/
#ifdef WIN32
- is_r = buf.st_mode & S_IRUSR;
- is_x = buf.st_mode & S_IXUSR;
- return is_x ? (is_r ? 0 : -2) : -1;
+ is_r = buf.st_mode & S_IRUSR;
+ is_x = buf.st_mode & S_IXUSR;
+ return is_x ? (is_r ? 0 : -2) : -1;
#else
euid = geteuid();
if (euid == buf.st_uid)
diff --git a/src/backend/utils/init/miscinit.c b/src/backend/utils/init/miscinit.c
index ea38b94973c..4ccc8042d0e 100644
--- a/src/backend/utils/init/miscinit.c
+++ b/src/backend/utils/init/miscinit.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/init/miscinit.c,v 1.110 2003/08/01 00:15:23 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/init/miscinit.c,v 1.111 2003/08/04 00:43:26 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -482,9 +482,9 @@ GetCharSetByHost(char *TableName, int host, const char *DataDir)
* restore the current user id if you need to change it.
* ----------------------------------------------------------------
*/
-static AclId AuthenticatedUserId = 0;
-static AclId SessionUserId = 0;
-static AclId CurrentUserId = 0;
+static AclId AuthenticatedUserId = 0;
+static AclId SessionUserId = 0;
+static AclId CurrentUserId = 0;
static bool AuthenticatedUserIsSuperuser = false;
@@ -620,7 +620,7 @@ SetSessionAuthorization(AclId userid, bool is_superuser)
!AuthenticatedUserIsSuperuser)
ereport(ERROR,
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
- errmsg("permission denied to set session authorization")));
+ errmsg("permission denied to set session authorization")));
SetSessionUserId(userid);
SetUserId(userid);
@@ -685,15 +685,16 @@ GetUserNameFromId(AclId userid)
static void
UnlinkLockFile(int status, Datum filename)
{
- char *fname = (char *)DatumGetPointer(filename);
- if( fname != NULL )
- {
- if( unlink(fname) != 0 )
+ char *fname = (char *) DatumGetPointer(filename);
+
+ if (fname != NULL)
{
- /* Should we complain if the unlink fails? */
+ if (unlink(fname) != 0)
+ {
+ /* Should we complain if the unlink fails? */
+ }
+ free(fname);
}
- free(fname);
- }
}
/*
@@ -789,11 +790,11 @@ CreateLockFile(const char *filename, bool amPostmaster,
errmsg("lock file \"%s\" already exists",
filename),
isDDLock ?
- errhint("Is another %s (pid %d) running in \"%s\"?",
- (encoded_pid < 0 ? "postgres" : "postmaster"),
- (int) other_pid, refName) :
+ errhint("Is another %s (pid %d) running in \"%s\"?",
+ (encoded_pid < 0 ? "postgres" : "postmaster"),
+ (int) other_pid, refName) :
errhint("Is another %s (pid %d) using \"%s\"?",
- (encoded_pid < 0 ? "postgres" : "postmaster"),
+ (encoded_pid < 0 ? "postgres" : "postmaster"),
(int) other_pid, refName)));
}
}
@@ -821,14 +822,14 @@ CreateLockFile(const char *filename, bool amPostmaster,
if (PGSharedMemoryIsInUse(id1, id2))
ereport(FATAL,
(errcode(ERRCODE_LOCK_FILE_EXISTS),
- errmsg("pre-existing shared memory block "
- "(key %lu, id %lu) is still in use",
- id1, id2),
- errhint("If you're sure there are no old "
- "backends still running, remove "
- "the shared memory block with "
- "ipcrm(1), or just delete \"%s\".",
- filename)));
+ errmsg("pre-existing shared memory block "
+ "(key %lu, id %lu) is still in use",
+ id1, id2),
+ errhint("If you're sure there are no old "
+ "backends still running, remove "
+ "the shared memory block with "
+ "ipcrm(1), or just delete \"%s\".",
+ filename)));
}
}
}
@@ -844,7 +845,7 @@ CreateLockFile(const char *filename, bool amPostmaster,
errmsg("could not remove old lock file \"%s\": %m",
filename),
errhint("The file seems accidentally left over, but "
- "I couldn't remove it. Please remove the file "
+ "I couldn't remove it. Please remove the file "
"by hand and try again.")));
}
@@ -865,7 +866,7 @@ CreateLockFile(const char *filename, bool amPostmaster,
errno = save_errno ? save_errno : ENOSPC;
ereport(FATAL,
(errcode_for_file_access(),
- errmsg("could not write lock file \"%s\": %m", filename)));
+ errmsg("could not write lock file \"%s\": %m", filename)));
}
close(fd);
@@ -912,17 +913,17 @@ TouchSocketLockFile(void)
if (socketLockFile[0] != '\0')
{
/*
- * utime() is POSIX standard, utimes() is a common alternative;
- * if we have neither, fall back to actually reading the file
- * (which only sets the access time not mod time, but that should
- * be enough in most cases). In all paths, we ignore errors.
+ * utime() is POSIX standard, utimes() is a common alternative; if
+ * we have neither, fall back to actually reading the file (which
+ * only sets the access time not mod time, but that should be
+ * enough in most cases). In all paths, we ignore errors.
*/
#ifdef HAVE_UTIME
utime(socketLockFile, NULL);
-#else /* !HAVE_UTIME */
+#else /* !HAVE_UTIME */
#ifdef HAVE_UTIMES
utimes(socketLockFile, NULL);
-#else /* !HAVE_UTIMES */
+#else /* !HAVE_UTIMES */
int fd;
char buffer[1];
@@ -932,8 +933,8 @@ TouchSocketLockFile(void)
read(fd, buffer, sizeof(buffer));
close(fd);
}
-#endif /* HAVE_UTIMES */
-#endif /* HAVE_UTIME */
+#endif /* HAVE_UTIMES */
+#endif /* HAVE_UTIME */
}
}
@@ -1072,13 +1073,13 @@ ValidatePgVersion(const char *path)
ret = fscanf(file, "%ld.%ld", &file_major, &file_minor);
if (ret != 2)
- ereport(FATAL,
- (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
- errmsg("\"%s\" is not a valid data directory",
- path),
- errdetail("File \"%s\" does not contain valid data.",
- full_path),
- errhint("You may need to initdb.")));
+ ereport(FATAL,
+ (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+ errmsg("\"%s\" is not a valid data directory",
+ path),
+ errdetail("File \"%s\" does not contain valid data.",
+ full_path),
+ errhint("You may need to initdb.")));
FreeFile(file);
@@ -1087,7 +1088,7 @@ ValidatePgVersion(const char *path)
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("database files are incompatible with server"),
errdetail("The data directory was initialized by PostgreSQL version %ld.%ld, "
- "which is not compatible with this version %s.",
+ "which is not compatible with this version %s.",
file_major, file_minor, version_string)));
}
@@ -1098,6 +1099,7 @@ ValidatePgVersion(const char *path)
#if defined(__mc68000__) && defined(__ELF__)
typedef int32 ((*func_ptr) ());
+
#else
typedef char *((*func_ptr) ());
#endif
@@ -1142,8 +1144,9 @@ process_preload_libraries(char *preload_libraries_string)
if (sep)
{
/*
- * a colon separator implies there is an initialization function
- * that we need to run in addition to loading the library
+ * a colon separator implies there is an initialization
+ * function that we need to run in addition to loading the
+ * library
*/
size_t filename_len = sep - tok;
size_t funcname_len = strlen(tok) - filename_len - 1;
@@ -1167,7 +1170,7 @@ process_preload_libraries(char *preload_libraries_string)
initfunc = (func_ptr) load_external_function(filename, funcname,
true, NULL);
if (initfunc)
- (*initfunc)();
+ (*initfunc) ();
if (funcname)
ereport(LOG,
@@ -1186,4 +1189,3 @@ process_preload_libraries(char *preload_libraries_string)
pfree(rawstring);
freeList(elemlist);
}
-
diff --git a/src/backend/utils/init/postinit.c b/src/backend/utils/init/postinit.c
index 9dc96f0653b..33c3e6a124b 100644
--- a/src/backend/utils/init/postinit.c
+++ b/src/backend/utils/init/postinit.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/init/postinit.c,v 1.124 2003/07/25 20:17:52 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/init/postinit.c,v 1.125 2003/08/04 00:43:26 momjian Exp $
*
*
*-------------------------------------------------------------------------
@@ -124,8 +124,8 @@ ReverifyMyDatabase(const char *name)
if (!dbform->datallowconn)
ereport(FATAL,
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
- errmsg("database \"%s\" is not currently accepting connections",
- name)));
+ errmsg("database \"%s\" is not currently accepting connections",
+ name)));
/*
* OK, we're golden. Only other to-do item is to save the encoding
@@ -179,8 +179,8 @@ InitCommunication(void)
if (!IsUnderPostmaster) /* postmaster already did this */
{
/*
- * We're running a postgres bootstrap process or a standalone backend.
- * Create private "shmem" and semaphores.
+ * We're running a postgres bootstrap process or a standalone
+ * backend. Create private "shmem" and semaphores.
*/
CreateSharedMemoryAndSemaphores(true, MaxBackends, 0);
}
@@ -272,8 +272,8 @@ InitPostgres(const char *dbname, const char *username)
(errcode(ERRCODE_UNDEFINED_DATABASE),
errmsg("database \"%s\" does not exist",
dbname),
- errdetail("The database subdirectory \"%s\" is missing.",
- fullpath)));
+ errdetail("The database subdirectory \"%s\" is missing.",
+ fullpath)));
else
ereport(FATAL,
(errcode_for_file_access(),
@@ -368,7 +368,7 @@ InitPostgres(const char *dbname, const char *username)
if (!ThereIsAtLeastOneUser())
ereport(WARNING,
(errcode(ERRCODE_UNDEFINED_OBJECT),
- errmsg("no users are defined in this database system"),
+ errmsg("no users are defined in this database system"),
errhint("You should immediately run 'CREATE USER \"%s\" WITH SYSID %d CREATEUSER;'.",
username, BOOTSTRAP_USESYSID)));
}
@@ -395,10 +395,10 @@ InitPostgres(const char *dbname, const char *username)
/*
* Check a normal user hasn't connected to a superuser reserved slot.
- * We can't do this till after we've read the user information, and
- * we must do it inside a transaction since checking superuserness
- * may require database access. The superuser check is probably the
- * most expensive part; don't do it until necessary.
+ * We can't do this till after we've read the user information, and we
+ * must do it inside a transaction since checking superuserness may
+ * require database access. The superuser check is probably the most
+ * expensive part; don't do it until necessary.
*/
if (ReservedBackends > 0 &&
CountEmptyBackendSlots() < ReservedBackends &&
@@ -419,8 +419,8 @@ InitPostgres(const char *dbname, const char *username)
InitializeClientEncoding();
/*
- * Now all default states are fully set up. Report them to client
- * if appropriate.
+ * Now all default states are fully set up. Report them to client if
+ * appropriate.
*/
BeginReportingGUCOptions();