httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From taka...@apache.org
Subject svn commit: r785604 - in /httpd/mod_fcgid/trunk/mod_fcgid: arch/unix/fcgid_pm_unix.c arch/unix/fcgid_proc_unix.c arch/win32/fcgid_pm_win.c arch/win32/fcgid_proc_win.c fcgid_conf.c
Date Wed, 17 Jun 2009 13:56:43 GMT
Author: takashi
Date: Wed Jun 17 13:56:43 2009
New Revision: 785604

URL: http://svn.apache.org/viewvc?rev=785604&view=rev
Log:
strncpy -> apr_cpystrn

Modified:
    httpd/mod_fcgid/trunk/mod_fcgid/arch/unix/fcgid_pm_unix.c
    httpd/mod_fcgid/trunk/mod_fcgid/arch/unix/fcgid_proc_unix.c
    httpd/mod_fcgid/trunk/mod_fcgid/arch/win32/fcgid_pm_win.c
    httpd/mod_fcgid/trunk/mod_fcgid/arch/win32/fcgid_proc_win.c
    httpd/mod_fcgid/trunk/mod_fcgid/fcgid_conf.c

Modified: httpd/mod_fcgid/trunk/mod_fcgid/arch/unix/fcgid_pm_unix.c
URL: http://svn.apache.org/viewvc/httpd/mod_fcgid/trunk/mod_fcgid/arch/unix/fcgid_pm_unix.c?rev=785604&r1=785603&r2=785604&view=diff
==============================================================================
--- httpd/mod_fcgid/trunk/mod_fcgid/arch/unix/fcgid_pm_unix.c (original)
+++ httpd/mod_fcgid/trunk/mod_fcgid/arch/unix/fcgid_pm_unix.c Wed Jun 17 13:56:43 2009
@@ -390,17 +390,14 @@
             if (initenv_entry[i].key == NULL
                 || initenv_entry[i].key[0] == '\0')
                 break;
-            strncpy(command->initenv_key[i], initenv_entry[i].key,
-                    INITENV_KEY_LEN);
-            command->initenv_key[i][INITENV_KEY_LEN - 1] = '\0';
-            strncpy(command->initenv_val[i], initenv_entry[i].val,
-                    INITENV_VAL_LEN);
-            command->initenv_val[i][INITENV_VAL_LEN - 1] = '\0';
+            apr_cpystrn(command->initenv_key[i], initenv_entry[i].key,
+                        INITENV_KEY_LEN);
+            apr_cpystrn(command->initenv_val[i], initenv_entry[i].val,
+                        INITENV_VAL_LEN);
         }
     }
 
-    strncpy(command->cgipath, argv0, _POSIX_PATH_MAX);
-    command->cgipath[_POSIX_PATH_MAX - 1] = '\0';
+    apr_cpystrn(command->cgipath, argv0, _POSIX_PATH_MAX);
     command->deviceid = deviceid;
     command->inode = inode;
     command->share_grp_id = share_grp_id;
@@ -409,8 +406,7 @@
     /* Update fcgid_command with wrapper info */
     command->wrapperpath[0] = '\0';
     if ((wrapperconf = get_wrapper_info(argv0, r))) {
-        strncpy(command->wrapperpath, wrapperconf->args, _POSIX_PATH_MAX);
-        command->wrapperpath[_POSIX_PATH_MAX - 1] = '\0';
+        apr_cpystrn(command->wrapperpath, wrapperconf->args, _POSIX_PATH_MAX);
         command->deviceid = wrapperconf->deviceid;
         command->inode = wrapperconf->inode;
         command->share_grp_id = wrapperconf->share_group_id;

Modified: httpd/mod_fcgid/trunk/mod_fcgid/arch/unix/fcgid_proc_unix.c
URL: http://svn.apache.org/viewvc/httpd/mod_fcgid/trunk/mod_fcgid/arch/unix/fcgid_proc_unix.c?rev=785604&r1=785603&r2=785604&view=diff
==============================================================================
--- httpd/mod_fcgid/trunk/mod_fcgid/arch/unix/fcgid_proc_unix.c (original)
+++ httpd/mod_fcgid/trunk/mod_fcgid/arch/unix/fcgid_proc_unix.c Wed Jun 17 13:56:43 2009
@@ -515,8 +515,8 @@
     /* Connect to fastcgi server */
     memset(&unix_addr, 0, sizeof(unix_addr));
     unix_addr.sun_family = AF_UNIX;
-    strncpy(unix_addr.sun_path, procnode->socket_path,
-            sizeof(unix_addr.sun_path) - 1);
+    apr_cpystrn(unix_addr.sun_path, procnode->socket_path,
+                sizeof(unix_addr.sun_path));
 
     /* I am the only one who connecting the server
        So I don't have to worry about ECONNREFUSED(listen queue overflow) problem,

Modified: httpd/mod_fcgid/trunk/mod_fcgid/arch/win32/fcgid_pm_win.c
URL: http://svn.apache.org/viewvc/httpd/mod_fcgid/trunk/mod_fcgid/arch/win32/fcgid_pm_win.c?rev=785604&r1=785603&r2=785604&view=diff
==============================================================================
--- httpd/mod_fcgid/trunk/mod_fcgid/arch/win32/fcgid_pm_win.c (original)
+++ httpd/mod_fcgid/trunk/mod_fcgid/arch/win32/fcgid_pm_win.c Wed Jun 17 13:56:43 2009
@@ -129,17 +129,14 @@
             if (initenv_entry[i].key == NULL
                 || initenv_entry[i].key[0] == '\0')
                 break;
-            strncpy(command->initenv_key[i], initenv_entry[i].key,
-                    INITENV_KEY_LEN);
-            command->initenv_key[i][INITENV_KEY_LEN - 1] = '\0';
-            strncpy(command->initenv_val[i], initenv_entry[i].val,
-                    INITENV_VAL_LEN);
-            command->initenv_val[i][INITENV_VAL_LEN - 1] = '\0';
+            apr_cpystrn(command->initenv_key[i], initenv_entry[i].key,
+                        INITENV_KEY_LEN);
+            apr_cpystrn(command->initenv_val[i], initenv_entry[i].val,
+                        INITENV_VAL_LEN);
         }
     }
 
-    strncpy(command->cgipath, argv0, _POSIX_PATH_MAX);
-    command->cgipath[_POSIX_PATH_MAX - 1] = '\0';
+    apr_cpystrn(command->cgipath, argv0, _POSIX_PATH_MAX);
     command->deviceid = deviceid;
     command->inode = inode;
     command->share_grp_id = share_grp_id;
@@ -150,8 +147,7 @@
     /* Update fcgid_command with wrapper info */
     command->wrapperpath[0] = '\0';
     if ((wrapperconf = get_wrapper_info(argv0, r))) {
-        strncpy(command->wrapperpath, wrapperconf->args, _POSIX_PATH_MAX);
-        command->wrapperpath[_POSIX_PATH_MAX - 1] = '\0';
+        apr_cpystrn(command->wrapperpath, wrapperconf->args, _POSIX_PATH_MAX);
         command->deviceid = wrapperconf->deviceid;
         command->inode = wrapperconf->inode;
         command->share_grp_id = wrapperconf->share_group_id;

Modified: httpd/mod_fcgid/trunk/mod_fcgid/arch/win32/fcgid_proc_win.c
URL: http://svn.apache.org/viewvc/httpd/mod_fcgid/trunk/mod_fcgid/arch/win32/fcgid_proc_win.c?rev=785604&r1=785603&r2=785604&view=diff
==============================================================================
--- httpd/mod_fcgid/trunk/mod_fcgid/arch/win32/fcgid_proc_win.c (original)
+++ httpd/mod_fcgid/trunk/mod_fcgid/arch/win32/fcgid_proc_win.c Wed Jun 17 13:56:43 2009
@@ -134,8 +134,7 @@
                      "mod_fcgid: can't create namedpipe for subprocess");
         return APR_ENOSOCKET;
     }
-    strncpy(procnode->socket_path, sock_path, _POSIX_PATH_MAX - 1);
-    procnode->socket_path[_POSIX_PATH_MAX - 1] = '\0';
+    apr_cpystrn(procnode->socket_path, sock_path, _POSIX_PATH_MAX);
 
     /* Build environment variables */
     proc_environ = ap_create_environment(procnode->proc_pool,

Modified: httpd/mod_fcgid/trunk/mod_fcgid/fcgid_conf.c
URL: http://svn.apache.org/viewvc/httpd/mod_fcgid/trunk/mod_fcgid/fcgid_conf.c?rev=785604&r1=785603&r2=785604&view=diff
==============================================================================
--- httpd/mod_fcgid/trunk/mod_fcgid/fcgid_conf.c (original)
+++ httpd/mod_fcgid/trunk/mod_fcgid/fcgid_conf.c Wed Jun 17 13:56:43 2009
@@ -630,9 +630,8 @@
                     sizeof(*dirconfig->authenticator_info));
     if (!dirconfig->authenticator_info)
         return "Can't alloc memory for authenticator_info";
-    strncpy(dirconfig->authenticator_info->path, authenticator,
-            _POSIX_PATH_MAX - 1);
-    dirconfig->authenticator_info->path[_POSIX_PATH_MAX - 1] = '\0';
+    apr_cpystrn(dirconfig->authenticator_info->path, authenticator,
+                _POSIX_PATH_MAX);
     dirconfig->authenticator_info->inode = finfo.inode;
     dirconfig->authenticator_info->deviceid = finfo.device;
     dirconfig->authenticator_info->share_group_id = (apr_size_t) - 1;
@@ -682,9 +681,8 @@
                     sizeof(*dirconfig->authorizer_info));
     if (!dirconfig->authorizer_info)
         return "Can't alloc memory for authorizer";
-    strncpy(dirconfig->authorizer_info->path, authorizer,
-            _POSIX_PATH_MAX - 1);
-    dirconfig->authorizer_info->path[_POSIX_PATH_MAX - 1] = '\0';
+    apr_cpystrn(dirconfig->authorizer_info->path, authorizer,
+                _POSIX_PATH_MAX);
     dirconfig->authorizer_info->inode = finfo.inode;
     dirconfig->authorizer_info->deviceid = finfo.device;
     dirconfig->authorizer_info->share_group_id = (apr_size_t) - 1;
@@ -734,8 +732,7 @@
                     sizeof(*dirconfig->access_info));
     if (!dirconfig->access_info)
         return "Can't alloc memory for access";
-    strncpy(dirconfig->access_info->path, access, _POSIX_PATH_MAX - 1);
-    dirconfig->access_info->path[_POSIX_PATH_MAX - 1] = '\0';
+    apr_cpystrn(dirconfig->access_info->path, access, _POSIX_PATH_MAX);
     dirconfig->access_info->inode = finfo.inode;
     dirconfig->access_info->deviceid = finfo.device;
     dirconfig->access_info->share_group_id = (apr_size_t) - 1;
@@ -833,8 +830,7 @@
                             wrapperpath, path, apr_get_os_error());
     }
 
-    strncpy(wrapper->args, wrapperpath, _POSIX_PATH_MAX - 1);
-    wrapper->args[_POSIX_PATH_MAX - 1] = '\0';
+    apr_cpystrn(wrapper->args, wrapperpath, _POSIX_PATH_MAX);
     wrapper->inode = finfo.inode;
     wrapper->deviceid = finfo.device;
     wrapper->share_group_id = *wrapper_id;



Mime
View raw message