[nginx] svn commit: r4738 - trunk/src/os/unix

ru at nginx.com ru at nginx.com
Tue Jul 3 13:05:18 UTC 2012


Author: ru
Date: 2012-07-03 13:05:18 +0000 (Tue, 03 Jul 2012)
New Revision: 4738
URL: http://trac.nginx.org/nginx/changeset/4738/nginx

Log:
Made sure to initialize the entire "struct flock" allocated on stack.


Modified:
   trunk/src/os/unix/ngx_files.c

Modified: trunk/src/os/unix/ngx_files.c
===================================================================
--- trunk/src/os/unix/ngx_files.c	2012-07-03 11:30:05 UTC (rev 4737)
+++ trunk/src/os/unix/ngx_files.c	2012-07-03 13:05:18 UTC (rev 4738)
@@ -413,9 +413,7 @@
 {
     struct flock  fl;
 
-    fl.l_start = 0;
-    fl.l_len = 0;
-    fl.l_pid = 0;
+    ngx_memzero(&fl, sizeof(struct flock));
     fl.l_type = F_WRLCK;
     fl.l_whence = SEEK_SET;
 
@@ -432,9 +430,7 @@
 {
     struct flock  fl;
 
-    fl.l_start = 0;
-    fl.l_len = 0;
-    fl.l_pid = 0;
+    ngx_memzero(&fl, sizeof(struct flock));
     fl.l_type = F_WRLCK;
     fl.l_whence = SEEK_SET;
 
@@ -451,9 +447,7 @@
 {
     struct flock  fl;
 
-    fl.l_start = 0;
-    fl.l_len = 0;
-    fl.l_pid = 0;
+    ngx_memzero(&fl, sizeof(struct flock));
     fl.l_type = F_UNLCK;
     fl.l_whence = SEEK_SET;
 



More information about the nginx-devel mailing list