dazuko-devel
[Top][All Lists]
Advanced

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

[Dazuko-devel] Telling O_WRONLY and O_RDWR apart


From: Sami Tikka
Subject: [Dazuko-devel] Telling O_WRONLY and O_RDWR apart
Date: Tue, 10 May 2005 17:37:25 +0300
User-agent: Mozilla Thunderbird 1.0.2 (X11/20050415)

Hi! I noticed that dazuko 2.0.6 running on Linux 2.6 cannot tell if file
was opened O_WRONLY or O_RDWR, they are both reported as O_WRONLY.

I guess the problem happened because the open flags are not bit masks
like the MAY_* flags passed to inode_permission callback.

The patch below seems to correct open flag reporting.

--- orig/dazuko_linux26.c
+++ mod/dazuko_linux26.c
@@ -734,15 +734,22 @@
        }
        else
        {
-               /* mask == 0 is passed in when a file is created */
-               if (mask == 0 || (mask & (MAY_WRITE|MAY_APPEND)) != 0)
+               if (mask == MAY_READ)
                {
-                       event_p.flags |= O_WRONLY;
+                       event_p.flags = O_RDONLY;
                        event_p.set_flags = 1;
-               }
-               if ((mask & MAY_READ) != 0)
+               }
+               /* mask == 0 is passed in when a file is created */
+               else if (mask == 0 || (mask & (MAY_WRITE|MAY_APPEND)) != 0)
                {
-                       event_p.flags |= O_RDONLY;
+                       if ((mask & MAY_READ) != 0)
+                       {
+                               event_p.flags = O_RDWR;
+                       }
+                       else
+                       {
+                               event_p.flags = O_WRONLY;
+                       }
                        event_p.set_flags = 1;
                }
        }



-- 
Sami Tikka                          tel: +358 9 2520 5115
Senior Software Engineer            fax: +358 9 2520 5013
F-Secure Corporation                http://www.F-Secure.com/
Be Sure.




reply via email to

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