* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/bootstrap/bootstrap.c,v 1.229 2007/01/22 01:35:19 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/bootstrap/bootstrap.c,v 1.230 2007/02/10 14:58:54 petere Exp $
*
*-------------------------------------------------------------------------
*/
SetConfigOption("fsync", "false", PGC_POSTMASTER, PGC_S_ARGV);
break;
case 'r':
- StrNCpy(OutputFileName, optarg, MAXPGPATH);
+ strlcpy(OutputFileName, optarg, MAXPGPATH);
break;
case 'x':
xlogop = atoi(optarg);
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/backend/libpq/crypt.c,v 1.72 2007/01/05 22:19:29 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/libpq/crypt.c,v 1.73 2007/02/10 14:58:54 petere Exp $
*
*-------------------------------------------------------------------------
*/
{
char salt[3];
- StrNCpy(salt, port->cryptSalt, 3);
+ strlcpy(salt, port->cryptSalt, sizeof(salt));
crypt_pwd = crypt(shadow_pass, salt);
break;
}
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/libpq/hba.c,v 1.159 2007/02/08 04:52:18 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/libpq/hba.c,v 1.160 2007/02/10 14:58:54 petere Exp $
*
*-------------------------------------------------------------------------
*/
return false;
}
- StrNCpy(ident_user, pass->pw_name, IDENT_USERNAME_MAX + 1);
+ strlcpy(ident_user, pass->pw_name, IDENT_USERNAME_MAX + 1);
return true;
#elif defined(SO_PEERCRED)
return false;
}
- StrNCpy(ident_user, pass->pw_name, IDENT_USERNAME_MAX + 1);
+ strlcpy(ident_user, pass->pw_name, IDENT_USERNAME_MAX + 1);
return true;
#elif defined(HAVE_STRUCT_CMSGCRED) || defined(HAVE_STRUCT_FCRED) || (defined(HAVE_STRUCT_SOCKCRED) && defined(LOCAL_CREDS))
return false;
}
- StrNCpy(ident_user, pw->pw_name, IDENT_USERNAME_MAX + 1);
+ strlcpy(ident_user, pw->pw_name, IDENT_USERNAME_MAX + 1);
return true;
#else
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/libpq/ip.c,v 1.39 2007/01/05 22:19:29 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/libpq/ip.c,v 1.40 2007/02/10 14:58:54 petere Exp $
*
* This file and the IPV6 implementation were initially provided by
* Nigel Kukard <nkukard@lbsd.net>, Linux Based Systems Design
if (rc != 0)
{
if (node)
- StrNCpy(node, "???", nodelen);
+ strlcpy(node, "???", nodelen);
if (service)
- StrNCpy(service, "???", servicelen);
+ strlcpy(service, "???", servicelen);
}
return rc;
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/nodes/print.c,v 1.83 2007/01/20 20:45:38 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/nodes/print.c,v 1.84 2007/02/10 14:58:54 petere Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
RangeTblEntry *rte;
rte = rt_fetch(((Scan *) p)->scanrelid, parsetree->rtable);
- StrNCpy(extraInfo, rte->eref->aliasname, NAMEDATALEN);
+ strlcpy(extraInfo, rte->eref->aliasname, NAMEDATALEN);
}
else if (IsA(p, IndexScan))
{
RangeTblEntry *rte;
rte = rt_fetch(((IndexScan *) p)->scan.scanrelid, parsetree->rtable);
- StrNCpy(extraInfo, rte->eref->aliasname, NAMEDATALEN);
+ strlcpy(extraInfo, rte->eref->aliasname, NAMEDATALEN);
}
else if (IsA(p, FunctionScan))
{
RangeTblEntry *rte;
rte = rt_fetch(((FunctionScan *) p)->scan.scanrelid, parsetree->rtable);
- StrNCpy(extraInfo, rte->eref->aliasname, NAMEDATALEN);
+ strlcpy(extraInfo, rte->eref->aliasname, NAMEDATALEN);
}
else if (IsA(p, ValuesScan))
{
RangeTblEntry *rte;
rte = rt_fetch(((ValuesScan *) p)->scan.scanrelid, parsetree->rtable);
- StrNCpy(extraInfo, rte->eref->aliasname, NAMEDATALEN);
+ strlcpy(extraInfo, rte->eref->aliasname, NAMEDATALEN);
}
else
extraInfo[0] = '\0';
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/postmaster/pgarch.c,v 1.28 2007/01/05 22:19:36 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/postmaster/pgarch.c,v 1.29 2007/02/10 14:58:54 petere Exp $
*
*-------------------------------------------------------------------------
*/
case 'p':
/* %p: relative path of source file */
sp++;
- StrNCpy(dp, pathname, endp - dp);
+ strlcpy(dp, pathname, endp - dp);
make_native_path(dp);
dp += strlen(dp);
break;
case 'f':
/* %f: filename of source file */
sp++;
- StrNCpy(dp, xlog, endp - dp);
+ strlcpy(dp, xlog, endp - dp);
dp += strlen(dp);
break;
case '%':
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.518 2007/02/08 15:46:04 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.519 2007/02/10 14:58:54 petere Exp $
*
* NOTES
*
memcpy(¶m->port, port, sizeof(Port));
write_inheritable_socket(¶m->portsocket, port->sock, childPid);
- StrNCpy(param->DataDir, DataDir, MAXPGPATH);
+ strlcpy(param->DataDir, DataDir, MAXPGPATH);
memcpy(¶m->ListenSocket, &ListenSocket, sizeof(ListenSocket));
memcpy(¶m->syslogPipe, &syslogPipe, sizeof(syslogPipe));
- StrNCpy(param->my_exec_path, my_exec_path, MAXPGPATH);
+ strlcpy(param->my_exec_path, my_exec_path, MAXPGPATH);
- StrNCpy(param->pkglib_path, pkglib_path, MAXPGPATH);
+ strlcpy(param->pkglib_path, pkglib_path, MAXPGPATH);
- StrNCpy(param->ExtraOptions, ExtraOptions, MAXPGPATH);
+ strlcpy(param->ExtraOptions, ExtraOptions, MAXPGPATH);
- StrNCpy(param->lc_collate, setlocale(LC_COLLATE, NULL), LOCALE_NAME_BUFLEN);
- StrNCpy(param->lc_ctype, setlocale(LC_CTYPE, NULL), LOCALE_NAME_BUFLEN);
+ strlcpy(param->lc_collate, setlocale(LC_COLLATE, NULL), LOCALE_NAME_BUFLEN);
+ strlcpy(param->lc_ctype, setlocale(LC_CTYPE, NULL), LOCALE_NAME_BUFLEN);
return true;
}
memcpy(&syslogPipe, ¶m->syslogPipe, sizeof(syslogPipe));
- StrNCpy(my_exec_path, param->my_exec_path, MAXPGPATH);
+ strlcpy(my_exec_path, param->my_exec_path, MAXPGPATH);
- StrNCpy(pkglib_path, param->pkglib_path, MAXPGPATH);
+ strlcpy(pkglib_path, param->pkglib_path, MAXPGPATH);
- StrNCpy(ExtraOptions, param->ExtraOptions, MAXPGPATH);
+ strlcpy(ExtraOptions, param->ExtraOptions, MAXPGPATH);
setlocale(LC_COLLATE, param->lc_collate);
setlocale(LC_CTYPE, param->lc_ctype);
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.521 2007/01/05 22:19:39 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.522 2007/02/10 14:58:55 petere Exp $
*
* NOTES
* this is the "main" module of the postgres backend and
case 'r':
/* send output (stdout and stderr) to the given file */
if (secure)
- StrNCpy(OutputFileName, optarg, MAXPGPATH);
+ strlcpy(OutputFileName, optarg, MAXPGPATH);
break;
case 'S':
*
* Copyright (c) 2000-2007, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/backend/utils/misc/guc-file.l,v 1.46 2007/01/05 22:19:46 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/misc/guc-file.l,v 1.47 2007/02/10 14:58:55 petere Exp $
*/
%{
if (!is_absolute_path(config_file))
{
Assert(calling_file != NULL);
- StrNCpy(abs_path, calling_file, MAXPGPATH);
+ strlcpy(abs_path, calling_file, sizeof(abs_path));
get_parent_directory(abs_path);
join_path_components(abs_path, abs_path, config_file);
canonicalize_path(abs_path);
* Portions Copyright (c) 1994, Regents of the University of California
* Portions taken from FreeBSD.
*
- * $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.131 2007/02/01 19:10:28 momjian Exp $
+ * $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.132 2007/02/10 14:58:55 petere Exp $
*
*-------------------------------------------------------------------------
*/
char full_path[MAXPGPATH];
if (find_my_exec(argv[0], full_path) < 0)
- StrNCpy(full_path, progname, MAXPGPATH);
+ strlcpy(full_path, progname, sizeof(full_path));
if (ret == -1)
fprintf(stderr,
*
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/bin/pg_ctl/pg_ctl.c,v 1.77 2007/02/01 19:10:28 momjian Exp $
+ * $PostgreSQL: pgsql/src/bin/pg_ctl/pg_ctl.c,v 1.78 2007/02/10 14:58:55 petere Exp $
*
*-------------------------------------------------------------------------
*/
/* advance past whitespace/quoting */
while (isspace((unsigned char) *p) || *p == '\'' || *p == '"')
p++;
- StrNCpy(portstr, p, Min(strcspn(p, "\"'" WHITESPACE) + 1,
+ strlcpy(portstr, p, Min(strcspn(p, "\"'" WHITESPACE) + 1,
sizeof(portstr)));
/* keep looking, maybe there is another -p */
}
p++;
while (isspace((unsigned char) *p))
p++;
- StrNCpy(portstr, p, Min(strcspn(p, "#" WHITESPACE) + 1,
+ strlcpy(portstr, p, Min(strcspn(p, "#" WHITESPACE) + 1,
sizeof(portstr)));
/* keep looking, maybe there is another */
}
/* environment */
if (!*portstr && getenv("PGPORT") != NULL)
- StrNCpy(portstr, getenv("PGPORT"), sizeof(portstr));
+ strlcpy(portstr, getenv("PGPORT"), sizeof(portstr));
/* default */
if (!*portstr)
char full_path[MAXPGPATH];
if (find_my_exec(argv0, full_path) < 0)
- StrNCpy(full_path, progname, MAXPGPATH);
+ strlcpy(full_path, progname, sizeof(full_path));
if (ret == -1)
write_stderr(_("The program \"postgres\" is needed by %s "
* Portions Copyright (c) 1994, Regents of the University of California
*
*
- * $PostgreSQL: pgsql/src/bin/pg_dump/pg_dumpall.c,v 1.89 2007/01/25 03:30:43 momjian Exp $
+ * $PostgreSQL: pgsql/src/bin/pg_dump/pg_dumpall.c,v 1.90 2007/02/10 14:58:55 petere Exp $
*
*-------------------------------------------------------------------------
*/
char full_path[MAXPGPATH];
if (find_my_exec(argv[0], full_path) < 0)
- StrNCpy(full_path, progname, MAXPGPATH);
+ strlcpy(full_path, progname, sizeof(full_path));
if (ret == -1)
fprintf(stderr,
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/bin/pg_resetxlog/pg_resetxlog.c,v 1.56 2007/02/01 19:10:29 momjian Exp $
+ * $PostgreSQL: pgsql/src/bin/pg_resetxlog/pg_resetxlog.c,v 1.57 2007/02/10 14:58:55 petere Exp $
*
*-------------------------------------------------------------------------
*/
fprintf(stderr, _("%s: invalid LC_COLLATE setting\n"), progname);
exit(1);
}
- StrNCpy(ControlFile.lc_collate, localeptr, LOCALE_NAME_BUFLEN);
+ strlcpy(ControlFile.lc_collate, localeptr, sizeof(ControlFile.lc_collate));
localeptr = setlocale(LC_CTYPE, "");
if (!localeptr)
{
fprintf(stderr, _("%s: invalid LC_CTYPE setting\n"), progname);
exit(1);
}
- StrNCpy(ControlFile.lc_ctype, localeptr, LOCALE_NAME_BUFLEN);
+ strlcpy(ControlFile.lc_ctype, localeptr, sizeof(ControlFile.lc_ctype));
/*
* XXX eventually, should try to grovel through old XLOG to develop more
* exceed INITIAL_EXPBUFFER_SIZE (currently 256 bytes).
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/interfaces/libpq/fe-auth.c,v 1.122 2007/01/05 22:20:00 momjian Exp $
+ * $PostgreSQL: pgsql/src/interfaces/libpq/fe-auth.c,v 1.123 2007/02/10 14:58:55 petere Exp $
*
*-------------------------------------------------------------------------
*/
{
char salt[3];
- StrNCpy(salt, conn->cryptSalt, 3);
+ strlcpy(salt, conn->cryptSalt, sizeof(salt));
crypt_pwd = crypt(password, salt);
break;
}
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/interfaces/libpq/fe-connect.c,v 1.342 2007/02/08 11:10:27 petere Exp $
+ * $PostgreSQL: pgsql/src/interfaces/libpq/fe-connect.c,v 1.343 2007/02/10 14:58:55 petere Exp $
*
*-------------------------------------------------------------------------
*/
*/
if ((tmpsock = socket(raddr->addr.ss_family, SOCK_STREAM, 0)) < 0)
{
- StrNCpy(errbuf, "PQcancel() -- socket() failed: ", errbufsize);
+ strlcpy(errbuf, "PQcancel() -- socket() failed: ", errbufsize);
goto cancel_errReturn;
}
retry3:
if (SOCK_ERRNO == EINTR)
/* Interrupted system call - we'll just try again */
goto retry3;
- StrNCpy(errbuf, "PQcancel() -- connect() failed: ", errbufsize);
+ strlcpy(errbuf, "PQcancel() -- connect() failed: ", errbufsize);
goto cancel_errReturn;
}
if (SOCK_ERRNO == EINTR)
/* Interrupted system call - we'll just try again */
goto retry4;
- StrNCpy(errbuf, "PQcancel() -- send() failed: ", errbufsize);
+ strlcpy(errbuf, "PQcancel() -- send() failed: ", errbufsize);
goto cancel_errReturn;
}
{
if (!cancel)
{
- StrNCpy(errbuf, "PQcancel() -- no cancel object supplied", errbufsize);
+ strlcpy(errbuf, "PQcancel() -- no cancel object supplied", errbufsize);
return FALSE;
}
if (conn->sock < 0)
{
- StrNCpy(conn->errorMessage.data,
+ strlcpy(conn->errorMessage.data,
"PQrequestCancel() -- connection is not open\n",
conn->errorMessage.maxlen);
conn->errorMessage.len = strlen(conn->errorMessage.data);
if ((passfile_env = getenv("PGPASSFILE")) != NULL)
/* use the literal path from the environment, if set */
- StrNCpy(pgpassfile, passfile_env, MAXPGPATH);
+ strlcpy(pgpassfile, passfile_env, sizeof(pgpassfile));
else
{
char homedir[MAXPGPATH];
if (pqGetpwuid(geteuid(), &pwdstr, pwdbuf, sizeof(pwdbuf), &pwd) != 0)
return false;
- StrNCpy(buf, pwd->pw_dir, bufsize);
+ strlcpy(buf, pwd->pw_dir, bufsize);
return true;
#else
char tmppath[MAX_PATH];
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/timezone/pgtz.c,v 1.49 2007/01/05 22:20:04 momjian Exp $
+ * $PostgreSQL: pgsql/src/timezone/pgtz.c,v 1.50 2007/02/10 14:58:55 petere Exp $
*
*-------------------------------------------------------------------------
*/
if (score > *bestscore)
{
*bestscore = score;
- StrNCpy(bestzonename, tzdirsub, TZ_STRLEN_MAX + 1);
+ strlcpy(bestzonename, tzdirsub, TZ_STRLEN_MAX + 1);
}
else if (score == *bestscore)
{
if (strlen(tzdirsub) < strlen(bestzonename) ||
(strlen(tzdirsub) == strlen(bestzonename) &&
strcmp(tzdirsub, bestzonename) < 0))
- StrNCpy(bestzonename, tzdirsub, TZ_STRLEN_MAX + 1);
+ strlcpy(bestzonename, tzdirsub, TZ_STRLEN_MAX + 1);
}
}