]> granicus.if.org Git - postgresql/commitdiff
StrNCpy -> strlcpy (not complete)
authorPeter Eisentraut <peter_e@gmx.net>
Sat, 10 Feb 2007 14:58:55 +0000 (14:58 +0000)
committerPeter Eisentraut <peter_e@gmx.net>
Sat, 10 Feb 2007 14:58:55 +0000 (14:58 +0000)
16 files changed:
src/backend/bootstrap/bootstrap.c
src/backend/libpq/crypt.c
src/backend/libpq/hba.c
src/backend/libpq/ip.c
src/backend/nodes/print.c
src/backend/postmaster/pgarch.c
src/backend/postmaster/postmaster.c
src/backend/tcop/postgres.c
src/backend/utils/misc/guc-file.l
src/bin/initdb/initdb.c
src/bin/pg_ctl/pg_ctl.c
src/bin/pg_dump/pg_dumpall.c
src/bin/pg_resetxlog/pg_resetxlog.c
src/interfaces/libpq/fe-auth.c
src/interfaces/libpq/fe-connect.c
src/timezone/pgtz.c

index 1241fbf981917c7a3ca845fe9545abe1d3bbbc40..be4a219ef0a467c54f17b6e578ee01492278175e 100644 (file)
@@ -8,7 +8,7 @@
  * 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 $
  *
  *-------------------------------------------------------------------------
  */
@@ -277,7 +277,7 @@ BootstrapMain(int argc, char *argv[])
                                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);
index c3a7f1cce11bb7eed7098813e21eb34b49990e9a..03d5b8d64cd5d6dda298f7b6c021b4eea5f7dafc 100644 (file)
@@ -9,7 +9,7 @@
  * 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 $
  *
  *-------------------------------------------------------------------------
  */
@@ -110,7 +110,7 @@ md5_crypt_verify(const Port *port, const char *role, char *client_pass)
                        {
                                char            salt[3];
 
-                               StrNCpy(salt, port->cryptSalt, 3);
+                               strlcpy(salt, port->cryptSalt, sizeof(salt));
                                crypt_pwd = crypt(shadow_pass, salt);
                                break;
                        }
index 94df19bc2cd63527e970cab3cb7c3b8c61677c5e..a3accd47c5250bc48a8d236abf21e3145d27aff4 100644 (file)
@@ -10,7 +10,7 @@
  *
  *
  * 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 $
  *
  *-------------------------------------------------------------------------
  */
@@ -1463,7 +1463,7 @@ ident_unix(int sock, char *ident_user)
                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)
@@ -1493,7 +1493,7 @@ ident_unix(int sock, char *ident_user)
                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))
@@ -1562,7 +1562,7 @@ ident_unix(int sock, char *ident_user)
                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
index 977787f1413d709df499944affa213bf4e6a1540..2e9bd9889006b23c0da3778dbc893b60eaf16c93 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * 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
@@ -175,9 +175,9 @@ pg_getnameinfo_all(const struct sockaddr_storage * addr, int salen,
        if (rc != 0)
        {
                if (node)
-                       StrNCpy(node, "???", nodelen);
+                       strlcpy(node, "???", nodelen);
                if (service)
-                       StrNCpy(service, "???", servicelen);
+                       strlcpy(service, "???", servicelen);
        }
 
        return rc;
index e50ebf2bb557c76bdc219b66e3a6b546940984ca..06d28b56b21641c959e113c50ede6915dba6594d 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * 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
@@ -574,28 +574,28 @@ print_plan_recursive(Plan *p, Query *parsetree, int indentLevel, char *label)
                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';
index 2f798f40b3a5ba1b06cf245dfa63766ce0dbdd58..991a22191f93c7a3be9212539f424b2af53c4f69 100644 (file)
@@ -19,7 +19,7 @@
  *
  *
  * 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 $
  *
  *-------------------------------------------------------------------------
  */
@@ -429,14 +429,14 @@ pgarch_archiveXlog(char *xlog)
                                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 '%':
index 06d8f99a82bbb8db461e10cea7ba8af8dbf2b390..6b3bea6eb5e837b700fed415906cb0893d35aeb9 100644 (file)
@@ -37,7 +37,7 @@
  *
  *
  * 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
  *
@@ -3828,7 +3828,7 @@ save_backend_variables(BackendParameters * param, Port *port,
        memcpy(&param->port, port, sizeof(Port));
        write_inheritable_socket(&param->portsocket, port->sock, childPid);
 
-       StrNCpy(param->DataDir, DataDir, MAXPGPATH);
+       strlcpy(param->DataDir, DataDir, MAXPGPATH);
 
        memcpy(&param->ListenSocket, &ListenSocket, sizeof(ListenSocket));
 
@@ -3859,14 +3859,14 @@ save_backend_variables(BackendParameters * param, Port *port,
 
        memcpy(&param->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;
 }
@@ -4060,11 +4060,11 @@ restore_backend_variables(BackendParameters * param, Port *port)
 
        memcpy(&syslogPipe, &param->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);
index c9d8c32f92d95f77cf61b0f3c44b0f2b649caa71..51eb8fabcf2fc82f4ddbdf4dd14cc3c8e06c237d 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * 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
@@ -2846,7 +2846,7 @@ PostgresMain(int argc, char *argv[], const char *username)
                        case 'r':
                                /* send output (stdout and stderr) to the given file */
                                if (secure)
-                                       StrNCpy(OutputFileName, optarg, MAXPGPATH);
+                                       strlcpy(OutputFileName, optarg, MAXPGPATH);
                                break;
 
                        case 'S':
index 156fc94181dd3be4b258c41b2d7f2dc2f5d32a89..c9b6958cee5604afb15bc4b46b4be0e71175ca35 100644 (file)
@@ -4,7 +4,7 @@
  *
  * 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 $
  */
 
 %{
@@ -218,7 +218,7 @@ ParseConfigFile(const char *config_file, const char *calling_file,
        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);
index ea7b949aa002578d2334c85169c7da1fd89845d6..5b559aecc95645110946fd122d02117f7f341efa 100644 (file)
@@ -42,7 +42,7 @@
  * 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 $
  *
  *-------------------------------------------------------------------------
  */
@@ -2706,7 +2706,7 @@ main(int argc, char *argv[])
                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,
index 5e430047c3591c8f36f8e68a9b83032673ec23c5..615578145702d5fb66c8076d923f288a57970f2a 100644 (file)
@@ -4,7 +4,7 @@
  *
  * 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 $
  *
  *-------------------------------------------------------------------------
  */
@@ -416,7 +416,7 @@ test_postmaster_connection(void)
                        /* 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 */
                }
@@ -449,7 +449,7 @@ test_postmaster_connection(void)
                                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 */
                        }
@@ -458,7 +458,7 @@ test_postmaster_connection(void)
 
        /* environment */
        if (!*portstr && getenv("PGPORT") != NULL)
-               StrNCpy(portstr, getenv("PGPORT"), sizeof(portstr));
+               strlcpy(portstr, getenv("PGPORT"), sizeof(portstr));
 
        /* default */
        if (!*portstr)
@@ -594,7 +594,7 @@ do_start(void)
                        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 "
index e2e3a9f5bb0a1454b61e1fc11682e823f76eaf74..0540969e84bc20cf4743f7da6e824873fc951f46 100644 (file)
@@ -6,7 +6,7 @@
  * 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 $
  *
  *-------------------------------------------------------------------------
  */
@@ -150,7 +150,7 @@ main(int argc, char *argv[])
                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,
index 9705baced7cadbe873a6837aafc37cdbaba15b2c..1cb7fef0596036ff92dcd193e85bfc064e5cea5e 100644 (file)
@@ -23,7 +23,7 @@
  * 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 $
  *
  *-------------------------------------------------------------------------
  */
@@ -498,14 +498,14 @@ GuessControlValues(void)
                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
index 24ea3db0d20a607ee1525c090314e762d5939c7c..82d7394457d0787de9f0d130c8dbf3da6e3ea051 100644 (file)
@@ -10,7 +10,7 @@
  * 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 $
  *
  *-------------------------------------------------------------------------
  */
@@ -418,7 +418,7 @@ pg_password_sendauth(PGconn *conn, const char *password, AuthRequest areq)
                        {
                                char            salt[3];
 
-                               StrNCpy(salt, conn->cryptSalt, 3);
+                               strlcpy(salt, conn->cryptSalt, sizeof(salt));
                                crypt_pwd = crypt(password, salt);
                                break;
                        }
index 891bf3f9ac7e9868a45433285f926f6db47acc00..e7f61ebdb96f652b7724af2dc199a5dae5fb1ac5 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * 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 $
  *
  *-------------------------------------------------------------------------
  */
@@ -2208,7 +2208,7 @@ internal_cancel(SockAddr *raddr, int be_pid, int be_key,
         */
        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:
@@ -2218,7 +2218,7 @@ 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;
        }
 
@@ -2239,7 +2239,7 @@ retry4:
                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;
        }
 
@@ -2297,7 +2297,7 @@ PQcancel(PGcancel *cancel, char *errbuf, int errbufsize)
 {
        if (!cancel)
        {
-               StrNCpy(errbuf, "PQcancel() -- no cancel object supplied", errbufsize);
+               strlcpy(errbuf, "PQcancel() -- no cancel object supplied", errbufsize);
                return FALSE;
        }
 
@@ -2328,7 +2328,7 @@ PQrequestCancel(PGconn *conn)
 
        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);
@@ -3609,7 +3609,7 @@ PasswordFromFile(char *hostname, char *port, char *dbname, char *username)
 
        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];
@@ -3700,7 +3700,7 @@ pqGetHomeDirectory(char *buf, int bufsize)
 
        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];
index 0afaae006c054731d4493e7baa537c0912312112..3be06895312b49f3eb7d431cfa19208e7a59bb4d 100644 (file)
@@ -6,7 +6,7 @@
  * 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 $
  *
  *-------------------------------------------------------------------------
  */
@@ -566,7 +566,7 @@ scan_available_timezones(char *tzdir, char *tzdirsub, struct tztry * tt,
                        if (score > *bestscore)
                        {
                                *bestscore = score;
-                               StrNCpy(bestzonename, tzdirsub, TZ_STRLEN_MAX + 1);
+                               strlcpy(bestzonename, tzdirsub, TZ_STRLEN_MAX + 1);
                        }
                        else if (score == *bestscore)
                        {
@@ -574,7 +574,7 @@ scan_available_timezones(char *tzdir, char *tzdirsub, struct tztry * tt,
                                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);
                        }
                }