Changeset 9a8c188 in mainline


Ignore:
Timestamp:
2013-07-24T21:12:25Z (11 years ago)
Author:
Ji?? Z?rev?cky <zarevucky.jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
1393bbb
Parents:
0b18364
Message:

Fix a bug and work around applications that call open() incorrectly.

Location:
uspace
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/vfs/vfs.c

    r0b18364 r9a8c188  
    329329static int open_internal(const char *abs, size_t abs_size, int lflag, int oflag)
    330330{
     331        // FIXME: Some applications call this incorrectly.
     332        if ((oflag & (O_RDONLY|O_WRONLY|O_RDWR)) == 0) {
     333                oflag |= O_RDWR;
     334        }
     335
     336        assert((((oflag & O_RDONLY) != 0) + ((oflag & O_WRONLY) != 0) + ((oflag & O_RDWR) != 0)) == 1);
     337       
    331338        async_exch_t *exch = vfs_exchange_begin();
    332339       
  • uspace/srv/vfs/vfs.c

    r0b18364 r9a8c188  
    8989                        break;
    9090                case VFS_IN_OPEN2:
    91                         vfs_open(callid, &call);
     91                        vfs_open2(callid, &call);
    9292                        break;
    9393                case VFS_IN_OPEN:
  • uspace/srv/vfs/vfs.h

    r0b18364 r9a8c188  
    228228
    229229extern void vfs_walk(ipc_callid_t, ipc_call_t *);
    230 extern void vfs_create(ipc_callid_t, ipc_call_t *);
    231230extern void vfs_open2(ipc_callid_t, ipc_call_t *);
    232231
  • uspace/srv/vfs/vfs_ops.c

    r0b18364 r9a8c188  
    767767        }
    768768       
     769        if ((((oflag & O_RDONLY) != 0) + ((oflag & O_WRONLY) != 0) + ((oflag & O_RDWR) != 0)) != 1) {
     770                async_answer_0(rid, EINVAL);
     771                return;
     772        }
     773       
    769774        if (oflag & O_CREAT)
    770775                lflag |= L_CREATE;
     
    840845        vfs_file_t *file = vfs_file_get(fd);
    841846       
    842         /* There is a potential race with another fibril of a malicious client. */
    843         if (!file) {
    844                 vfs_node_put(node);
    845                 async_answer_0(rid, EBUSY);
    846                 return;
    847         }
     847        /* FIXME: There is a potential race with another fibril of a malicious client. */
     848        assert(file);
    848849       
    849850        file->node = node;
     
    856857        if (oflag & O_APPEND)
    857858                file->append = true;
     859        assert(file->open_read || file->open_write);
    858860       
    859861        /*
Note: See TracChangeset for help on using the changeset viewer.