From: Samuel Q. <Sam...@sy...> - 2012-11-20 17:15:52
|
Hello, I have crackerjack-3.3. When I run the write test almost every test fails with "Bad file descriptor". This is because most of the files are opened readonly – using FLAGS2 in lib/kor/test_common.c. See for example symbolic_exist_file_fd() in test_common.c: #define FLAGS O_RDWR #define FLAGS2 O_RDONLY int symbolic_exist_file_fd() { int fd; char tmpfile[MAXFILENAME]; memset(&tmpfile, 0, MAXFILENAME); strcpy(tmpfile, symbolic_exist_file()); fd = open(tmpfile, FLAGS2); errno=0; return fd; } It seems to me like there should be a version of symbolic_exist_file_fd() that uses FLAGS instead of FLAGS2 for the write case. Why does cs_write.c call symbolic_exist_file_fd()? Look at this declaration in testcases/write/cs_write.h: cs_write.h struct data_and_gen fd_data[] = { #include "fd_name_read.h" }; include/kor/fd_name_read.h { 1, "EXIST_FILE_FD", exist_file_fd }, { 2, "EXIST_DIR_FD", exist_dir_fd }, { 3, "SYMBOLIC_EXIST_FILE_FD", symbolic_exist_file_fd }, { 4, "SYMBOLIC_EXIST_DIR_FD", symbolic_exist_dir_fd }, { 5, "PIPE_FD", pipe_fd }, //{ 6, "FIFO_FD", fifo_fd }, // be holding status { 7, "MAX_FD", max_fd }, { 8, "INVALID_FD", invalid_fd }, { 9, "CLOSE_FD", close_fd }, { FINAL_DATA, NULL, NULL } There is a similar issue with pipe_fd(), it returns the read end of the pipe. Shouldn't there be a version that returns the write end? -Sam |