commit-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[hurd] 43/43: storeio: Avoid calling mmap with zero size


From: Samuel Thibault
Subject: [hurd] 43/43: storeio: Avoid calling mmap with zero size
Date: Mon, 11 Sep 2017 07:10:12 +0000

This is an automated email from the git hooks/post-receive script.

sthibault pushed a commit to branch upstream
in repository hurd.

commit 796f8789f80568861b747265998f31fa83091915
Author: Samuel Thibault <address@hidden>
Date:   Mon Sep 11 00:48:17 2017 +0200

    storeio: Avoid calling mmap with zero size
    
    * storeio/dev.c (dev_open): When store is zero-sized, set buf to NULL
    instead of calling mmap().
---
 storeio/dev.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/storeio/dev.c b/storeio/dev.c
index 78e0a17..8bdfa11 100644
--- a/storeio/dev.c
+++ b/storeio/dev.c
@@ -161,8 +161,11 @@ dev_open (struct dev *dev)
      to support this.  */
   store_set_flags (dev->store, STORE_INACTIVE);
 
-  dev->buf = mmap (0, dev->store->block_size, PROT_READ|PROT_WRITE,
-                  MAP_ANON, 0, 0);
+  if (! dev->store->block_size)
+    dev->buf = NULL;
+  else
+    dev->buf = mmap (0, dev->store->block_size, PROT_READ|PROT_WRITE,
+                    MAP_ANON, 0, 0);
   if (dev->buf == MAP_FAILED)
     {
       store_free (dev->store);

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-hurd/hurd.git



reply via email to

[Prev in Thread] Current Thread [Next in Thread]