diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2006-09-27 18:40:10 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2006-09-27 18:40:10 +0000 |
commit | c92f7e258ee579abd0f95183598edf250d351b2c (patch) | |
tree | 10c6b377a74c61b71ece70cfd3cb209795bf1051 /src/port/path.c | |
parent | 996b203e621bc76985ff0156b4f2ef720944b41b (diff) | |
download | postgresql-c92f7e258ee579abd0f95183598edf250d351b2c.tar.gz postgresql-c92f7e258ee579abd0f95183598edf250d351b2c.zip |
Replace strncpy with strlcpy in selected places that seem possibly relevant
to performance. (A wholesale effort to get rid of strncpy should be
undertaken sometime, but not during beta.) This commit also fixes dynahash.c
to correctly truncate overlength string keys for hashtables, so that its
callers don't have to anymore.
Diffstat (limited to 'src/port/path.c')
-rw-r--r-- | src/port/path.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/port/path.c b/src/port/path.c index 4acb8046bfc..a7d5ec7c452 100644 --- a/src/port/path.c +++ b/src/port/path.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/port/path.c,v 1.68 2006/09/22 21:39:58 tgl Exp $ + * $PostgreSQL: pgsql/src/port/path.c,v 1.69 2006/09/27 18:40:10 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -174,7 +174,7 @@ join_path_components(char *ret_path, const char *head, const char *tail) { if (ret_path != head) - StrNCpy(ret_path, head, MAXPGPATH); + strlcpy(ret_path, head, MAXPGPATH); /* * Remove any leading "." and ".." in the tail component, adjusting head @@ -493,7 +493,7 @@ make_relative_path(char *ret_path, const char *target_path, * Set up my_exec_path without the actual executable name, and * canonicalize to simplify comparison to bin_path. */ - StrNCpy(ret_path, my_exec_path, MAXPGPATH); + strlcpy(ret_path, my_exec_path, MAXPGPATH); trim_directory(ret_path); /* remove my executable name */ canonicalize_path(ret_path); @@ -513,7 +513,7 @@ make_relative_path(char *ret_path, const char *target_path, } no_match: - StrNCpy(ret_path, target_path, MAXPGPATH); + strlcpy(ret_path, target_path, MAXPGPATH); canonicalize_path(ret_path); } @@ -625,7 +625,7 @@ get_home_path(char *ret_path) if (pqGetpwuid(geteuid(), &pwdstr, pwdbuf, sizeof(pwdbuf), &pwd) != 0) return false; - StrNCpy(ret_path, pwd->pw_dir, MAXPGPATH); + strlcpy(ret_path, pwd->pw_dir, MAXPGPATH); return true; #else char tmppath[MAX_PATH]; |