Changeset b19e892 in mainline for uspace/app/getterm/getterm.c


Ignore:
Timestamp:
2017-04-02T10:39:13Z (7 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
9c4cf0d
Parents:
80743a1
Message:

Merge open() with posix_open() and provide vfs_lookup_open() instead

vfs_lookup_open() is really just a convenience wrapper around
vfs_lookup() and vfs_open().

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/getterm/getterm.c

    r80743a1 rb19e892  
    3636
    3737#include <sys/types.h>
    38 #include <fcntl.h>
    3938#include <unistd.h>
    4039#include <stdio.h>
     
    5958}
    6059
    61 static void reopen(FILE **stream, int fd, const char *path, int flags,
    62     const char *mode)
     60static void reopen(FILE **stream, int fd, const char *path, int mode,
     61    const char *fmode)
    6362{
    6463        if (fclose(*stream))
     
    6766        *stream = NULL;
    6867       
    69         int oldfd = open(path, flags);
     68        int oldfd = vfs_lookup_open(path, WALK_REGULAR, mode);
    7069        if (oldfd < 0)
    7170                return;
     
    7978        }
    8079       
    81         *stream = fdopen(fd, mode);
     80        *stream = fdopen(fd, fmode);
    8281}
    8382
     
    142141        snprintf(term_node, LOC_NAME_MAXLEN, "%s/%s", locfs, term);
    143142       
    144         reopen(&stdin, 0, term_node, O_RDONLY, "r");
    145         reopen(&stdout, 1, term_node, O_WRONLY, "w");
    146         reopen(&stderr, 2, term_node, O_WRONLY, "w");
     143        reopen(&stdin, 0, term_node, MODE_READ, "r");
     144        reopen(&stdout, 1, term_node, MODE_WRITE, "w");
     145        reopen(&stderr, 2, term_node, MODE_WRITE, "w");
    147146       
    148147        if (stdin == NULL)
Note: See TracChangeset for help on using the changeset viewer.