Browse Source

[LibOS] Replace incorrect "&&" with "&" in fs/str/fs.c

Isaku Yamahata 6 years ago
parent
commit
50252c87e2
1 changed files with 3 additions and 3 deletions
  1. 3 3
      LibOS/shim/src/fs/str/fs.c

+ 3 - 3
LibOS/shim/src/fs/str/fs.c

@@ -76,7 +76,7 @@ int str_dput (struct shim_dentry * dent)
 
 int str_close (struct shim_handle * hdl)
 {
-    if (hdl->flags && (O_WRONLY|O_RDWR)) {
+    if (hdl->flags & (O_WRONLY|O_RDWR)) {
         int ret = str_flush(hdl);
 
         if (ret < 0)
@@ -91,7 +91,7 @@ ssize_t str_read (struct shim_handle * hdl, void * buf, size_t count)
 {
     ssize_t ret = 0;
 
-    if (!(hdl->acc_mode && MAY_READ)) {
+    if (!(hdl->acc_mode & MAY_READ)) {
         ret = -EACCES;
         goto out;
     }
@@ -134,7 +134,7 @@ out:
 
 ssize_t str_write (struct shim_handle * hdl, const void * buf, size_t count)
 {
-    if (!(hdl->acc_mode && MAY_WRITE))
+    if (!(hdl->acc_mode & MAY_WRITE))
         return -EACCES;
 
     struct shim_str_handle * strhdl = &hdl->info.str;