Changeset b19e892 in mainline for uspace/app/redir/redir.c
- Timestamp:
- 2017-04-02T10:39:13Z (8 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 9c4cf0d
- Parents:
- 80743a1
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/redir/redir.c
r80743a1 rb19e892 37 37 #include <sys/types.h> 38 38 #include <stdlib.h> 39 #include <fcntl.h>40 39 #include <unistd.h> 41 40 #include <str.h> … … 54 53 } 55 54 56 static void reopen(FILE **stream, int fd, const char *path, int flags, const char *mode) 55 static void reopen(FILE **stream, int fd, const char *path, int flags, int mode, 56 const char *fmode) 57 57 { 58 58 if (fclose(*stream)) … … 61 61 *stream = NULL; 62 62 63 int oldfd = open(path, flags);63 int oldfd = vfs_lookup_open(path, WALK_REGULAR | flags, mode); 64 64 if (oldfd < 0) 65 65 return; … … 73 73 } 74 74 75 *stream = fdopen(fd, mode);75 *stream = fdopen(fd, fmode); 76 76 } 77 77 … … 122 122 return -2; 123 123 } 124 reopen(&stdin, 0, argv[i], O_RDONLY, "r");124 reopen(&stdin, 0, argv[i], 0, MODE_READ, "r"); 125 125 } else if (str_cmp(argv[i], "-o") == 0) { 126 126 i++; … … 129 129 return -3; 130 130 } 131 reopen(&stdout, 1, argv[i], O_WRONLY | O_CREAT, "w"); 131 reopen(&stdout, 1, argv[i], WALK_MAY_CREATE, MODE_WRITE, 132 "w"); 132 133 } else if (str_cmp(argv[i], "-e") == 0) { 133 134 i++; … … 136 137 return -4; 137 138 } 138 reopen(&stderr, 2, argv[i], O_WRONLY | O_CREAT, "w"); 139 reopen(&stderr, 2, argv[i], WALK_MAY_CREATE, MODE_WRITE, 140 "w"); 139 141 } else if (str_cmp(argv[i], "--") == 0) { 140 142 i++;
Note:
See TracChangeset
for help on using the changeset viewer.