changeset 4788:e2cc3ef93014 stable-1.2

Merge of r4738: struct flock initialization. Made sure to initialize the entire "struct flock" allocated on stack.
author Maxim Dounin <mdounin@mdounin.ru>
date Mon, 06 Aug 2012 15:31:49 +0000
parents 7d0c7bf2874d
children 179a4d4073b3
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
+++ b/src/os/unix/ngx_files.c
@@ -413,9 +413,7 @@ ngx_trylock_fd(ngx_fd_t fd)
 {
     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 @@ ngx_lock_fd(ngx_fd_t fd)
 {
     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 @@ ngx_unlock_fd(ngx_fd_t fd)
 {
     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;