yaffs direct: Fix wrong condition for O_CREAT | O_EXCL
authorCharles Manning <cdhmanning@gmail.com>
Sat, 30 May 2015 23:45:03 +0000 (11:45 +1200)
committerCharles Manning <cdhmanning@gmail.com>
Sat, 30 May 2015 23:45:03 +0000 (11:45 +1200)
Thanks Chris for pointing this out.

Signed-off-by: Charles Manning <cdhmanning@gmail.com>
direct/yaffsfs.c

index 7afde717b97655b253e619bd43014cdb19a5337c..952ffacdbdf259901c5f3608b233210e03bf7bcc 100644 (file)
@@ -853,7 +853,7 @@ int yaffs_open_sharing_reldir(struct yaffs_obj *reldir, const YCHAR *path,
                oflag &= ~(O_EXCL);
 
        /* O_TRUNC has no meaning if (O_CREAT | O_EXCL) is specified */
                oflag &= ~(O_EXCL);
 
        /* O_TRUNC has no meaning if (O_CREAT | O_EXCL) is specified */
-       if ((oflag & O_CREAT) & (oflag & O_EXCL))
+       if ((oflag & O_CREAT) && (oflag & O_EXCL))
                oflag &= ~(O_TRUNC);
 
        /* Todo: Are there any more flag combos to sanitise ? */
                oflag &= ~(O_TRUNC);
 
        /* Todo: Are there any more flag combos to sanitise ? */