summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJérôme Loyet <fat@php.net>2011-01-30 13:51:20 +0000
committerJérôme Loyet <fat@php.net>2011-01-30 13:51:20 +0000
commitd7e9fdc199299ea35f00a8e9575842fd86a4e3f6 (patch)
tree5bebd906f813252e49ad135e97a37733b082cf3e
parent1e91069eb497a7d1ead7b09948b56fc50fc6cc82 (diff)
downloadphp-git-d7e9fdc199299ea35f00a8e9575842fd86a4e3f6.tar.gz
- remove cpystrn from FPM and use strlcpy instead.
-rw-r--r--sapi/fpm/fpm/fpm_request.c6
-rw-r--r--sapi/fpm/fpm/fpm_sockets.c2
-rw-r--r--sapi/fpm/fpm/fpm_str.h23
3 files changed, 4 insertions, 27 deletions
diff --git a/sapi/fpm/fpm/fpm_request.c b/sapi/fpm/fpm/fpm_request.c
index 9dcf08aa0a..6ba9e5170c 100644
--- a/sapi/fpm/fpm/fpm_request.c
+++ b/sapi/fpm/fpm/fpm_request.c
@@ -61,11 +61,11 @@ void fpm_request_info() /* {{{ */
fpm_clock_get(&slot->tv);
if (request_uri) {
- cpystrn(slot->request_uri, request_uri, sizeof(slot->request_uri));
+ strlcpy(slot->request_uri, request_uri, sizeof(slot->request_uri));
}
if (request_method) {
- cpystrn(slot->request_method, request_method, sizeof(slot->request_method));
+ strlcpy(slot->request_method, request_method, sizeof(slot->request_method));
}
slot->content_length = fpm_php_content_length(TSRMLS_C);
@@ -73,7 +73,7 @@ void fpm_request_info() /* {{{ */
/* if cgi.fix_pathinfo is set to "1" and script cannot be found (404)
the sapi_globals.request_info.path_translated is set to NULL */
if (script_filename) {
- cpystrn(slot->script_filename, script_filename, sizeof(slot->script_filename));
+ strlcpy(slot->script_filename, script_filename, sizeof(slot->script_filename));
}
fpm_shm_slots_release(slot);
diff --git a/sapi/fpm/fpm/fpm_sockets.c b/sapi/fpm/fpm/fpm_sockets.c
index baa9f9803a..d893150264 100644
--- a/sapi/fpm/fpm/fpm_sockets.c
+++ b/sapi/fpm/fpm/fpm_sockets.c
@@ -286,7 +286,7 @@ static int fpm_socket_af_unix_listening_socket(struct fpm_worker_pool_s *wp) /*
struct sockaddr_un sa_un;
memset(&sa_un, 0, sizeof(sa_un));
- cpystrn(sa_un.sun_path, wp->config->listen_address, sizeof(sa_un.sun_path));
+ strlcpy(sa_un.sun_path, wp->config->listen_address, sizeof(sa_un.sun_path));
sa_un.sun_family = AF_UNIX;
return fpm_sockets_get_listening_socket(wp, (struct sockaddr *) &sa_un, sizeof(struct sockaddr_un));
}
diff --git a/sapi/fpm/fpm/fpm_str.h b/sapi/fpm/fpm/fpm_str.h
index 2755dc50aa..65db5455a0 100644
--- a/sapi/fpm/fpm/fpm_str.h
+++ b/sapi/fpm/fpm/fpm_str.h
@@ -5,29 +5,6 @@
#ifndef FPM_STR_H
#define FPM_STR_H 1
-static inline char *cpystrn(char *dst, const char *src, size_t dst_size) /* {{{ */
-{
- char *d, *end;
-
- if (!dst_size) {
- return dst;
- }
-
- d = dst;
- end = dst + dst_size - 1;
-
- for (; d < end; ++d, ++src) {
- if (!(*d = *src)) {
- return d;
- }
- }
-
- *d = '\0';
-
- return d;
-}
-/* }}} */
-
static inline char *str_purify_filename(char *dst, char *src, size_t size) /* {{{ */
{
char *d, *end;