]> git.kaiwu.me - nginx.git/commitdiff
Merge of r4738: struct flock initialization.
authorMaxim Dounin <mdounin@mdounin.ru>
Mon, 6 Aug 2012 15:31:49 +0000 (15:31 +0000)
committerMaxim Dounin <mdounin@mdounin.ru>
Mon, 6 Aug 2012 15:31:49 +0000 (15:31 +0000)
Made sure to initialize the entire "struct flock" allocated on stack.

src/os/unix/ngx_files.c

index ca5458104e881381277b73e2505b064222897ba6..2dfa1b7a1ab967a5f02c5f5ff572e8c03b99d7a4 100644 (file)
@@ -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;