changeset 4737:9acc1a5a5b9a

Made sure to initialize the entire "struct flock" allocated on stack.
author Ruslan Ermilov <ru@nginx.com>
date Tue, 03 Jul 2012 13:05:18 +0000
parents cebbe4fda8aa
children 512c741fa841
files src/os/unix/ngx_files.c
diffstat 1 files changed, 3 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/src/os/unix/ngx_files.c	Tue Jul 03 11:30:05 2012 +0000
+++ b/src/os/unix/ngx_files.c	Tue Jul 03 13:05:18 2012 +0000
@@ -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;