Changeset 1ad26cd in rtems
- Timestamp:
- 10/18/18 10:38:58 (4 years ago)
- Branches:
- 5, master
- Children:
- 3cf12c9
- Parents:
- 3825926
- git-author:
- Sebastian Huber <sebastian.huber@…> (10/18/18 10:38:58)
- git-committer:
- Sebastian Huber <sebastian.huber@…> (10/22/18 06:06:05)
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
cpukit/libcsupport/src/open.c
r3825926 r1ad26cd 75 75 bool truncate = (oflag & O_TRUNC) == O_TRUNC; 76 76 bool open_dir; 77 int eval_flags = RTEMS_FS_FOLLOW_LINK 77 #ifdef O_NOFOLLOW 78 int follow = (oflag & O_NOFOLLOW) == O_NOFOLLOW ? 0 : RTEMS_FS_FOLLOW_LINK; 79 #else 80 int follow = RTEMS_FS_FOLLOW_LINK; 81 #endif 82 int eval_flags = follow 78 83 | (read_access ? RTEMS_FS_PERMS_READ : 0) 79 84 | (write_access ? RTEMS_FS_PERMS_WRITE : 0) -
testsuites/psxtests/psxfile01/test.c
r3825926 r1ad26cd 60 60 static const char somefile[] = "somefile"; 61 61 62 static const char somelink[] = "somelink"; 63 62 64 /* 63 65 * File test support routines. … … 153 155 status = unlink( somefile ); 154 156 rtems_test_assert( status == 0 ); 157 158 errno = 0; 159 fd = open( somefile, O_RDONLY ); 160 rtems_test_assert( fd == -1 ); 161 rtems_test_assert( errno == ENOENT ); 155 162 } 156 163 … … 175 182 status = unlink( somefile ); 176 183 rtems_test_assert( status == 0 ); 184 185 errno = 0; 186 fd = open( somefile, O_RDONLY ); 187 rtems_test_assert( fd == -1 ); 188 rtems_test_assert( errno == ENOENT ); 189 } 190 191 static void test_open_nofollow(void) 192 { 193 int status; 194 int fd; 195 struct stat st; 196 197 fd = open( somefile, O_CREAT, S_IRWXU ); 198 rtems_test_assert( fd >= 0 ); 199 200 status = close( fd ); 201 rtems_test_assert( status == 0 ); 202 203 status = symlink( somefile, somelink ); 204 rtems_test_assert( status == 0 ); 205 206 fd = open( somelink, O_RDONLY ); 207 rtems_test_assert( fd >= 0 ); 208 209 status = fstat( fd, &st ); 210 rtems_test_assert( status == 0 ); 211 rtems_test_assert( S_ISREG( st.st_mode ) ); 212 213 status = close( fd ); 214 rtems_test_assert( status == 0 ); 215 216 #ifdef O_NOFOLLOW 217 fd = open( somelink, O_RDONLY | O_NOFOLLOW ); 218 rtems_test_assert( fd >= 0 ); 219 220 status = fstat( fd, &st ); 221 rtems_test_assert( status == 0 ); 222 rtems_test_assert( S_ISLNK( st.st_mode ) ); 223 224 status = close( fd ); 225 rtems_test_assert( status == 0 ); 226 #endif 227 228 status = unlink( somelink ); 229 rtems_test_assert( status == 0 ); 230 231 errno = 0; 232 fd = open( somelink, O_RDONLY ); 233 rtems_test_assert( fd == -1 ); 234 rtems_test_assert( errno == ENOENT ); 235 236 status = unlink( somefile ); 237 rtems_test_assert( status == 0 ); 238 239 errno = 0; 240 fd = open( somefile, O_RDONLY ); 241 rtems_test_assert( fd == -1 ); 242 rtems_test_assert( errno == ENOENT ); 177 243 } 178 244 … … 210 276 test_open_directory(); 211 277 test_open_cloexec(); 278 test_open_nofollow(); 212 279 213 280 /*
Note: See TracChangeset
for help on using the changeset viewer.