| | 924 | | verify_fp( TF, rwstr ) |
| | 925 | | TMPFILE TF; |
| | 926 | | char *rwstr; |
| | 927 | | { |
| | 928 | | FPBUF FPBlast; |
| | 929 | | FPBUF FPBptr; |
| | 930 | | FPBUF FPB; |
| | 931 | | |
| | 932 | | int fd; |
| | 933 | | |
| | 934 | | |
| | 935 | | |
| | 936 | | if ( TF->fpbuf ) |
| | 937 | | { |
| | 938 | | |
| | 939 | | |
| | 940 | | if ( !strcmp( TF->fpbuf->rwstr, rwstr ) ) |
| | 941 | | { |
| | 942 | | |
| | 943 | | |
| | 944 | | if ( FPS != TF->fpbuf ) |
| | 945 | | { |
| | 946 | | if ( FPS == NULL )
|
| | 947 | | { |
| | 948 | | printf( "Warning: Empty File Ptr Buffer List\n" ); |
| | 949 | | |
| | 950 | | return( TRC_TRUE );
|
| | | | ... |
| | 970 | | |
| | 971 | | printf( |
| | 972 | | "Warning: Verify File Ptr Buffer Not Found\n" ); |
| | 973 | | } |
| | 974 | | |
| | 975 | | return( TRC_TRUE );
|
| | 976 | | } |
| | 977 | | |
| | 978 | | |
| | 979 | | |
| | 980 | | else |
| | 981 | | close_fp( TF ); |
| | 982 | | } |
| | 983 | | |
| | 984 | | |
| | 985 | | |
| | 986 | | if ( NFPS >= MAX_OPEN_FP )
|
| | 987 | | { |
| | 988 | | FPBptr = FPS; |
| | 989 | | |
| | 990 | | FPBlast = (FPBUF) NULL;
|
| | 991 | | |
| | 992 | | while ( FPBptr->next != NULL )
|
| | 993 | | { |
| | 994 | | FPBlast = FPBptr; |
| | 995 | | FPBptr = FPBptr->next; |
| | 996 | | } |
| | | | ... |
| | 999 | | free_fpbuf( &(FPBlast->next) ); |
| | 1000 | | |
| | 1001 | | else |
| | 1002 | | free_fpbuf( &(FPS) ); |
| | 1003 | | |
| | 1004 | | NFPS--; |
| | 1005 | | } |
| | 1006 | | |
| | 1007 | | |
| | 1008 | | |
| | 1009 | | FPB = create_fpbuf(); |
| | 1010 | | |
| | 1011 | | if ( !strcmp( rwstr, "w" ) ) |
| | 1012 | | { |
| | 1013 | | fd = open( TF->fname, O_RDWR|O_CREAT|O_EXCL|O_TRUNC, 0600 );
|
| | 1014 | | |
| | 1015 | | if ( !trc_fdcheck( fd, TF->fname ) ) |
| | 1016 | | return( TRC_FALSE );
|
| | 1017 | | |
| | 1018 | | FPB->fp = fdopen( fd, rwstr ); |
| | 1019 | | } |
| | 1020 | | |
| | 1021 | | else if ( !strcmp( rwstr, "a" ) ) |
| | 1022 | | { |
| referenced by returned value | 1023 | | fd = open( TF->fname, | Problem | | referenced by returned value |
|
| | 1024 | | O_RDWR|O_APPEND|O_CREAT|O_EXCL|O_TRUNC, 0600 );
|
| | 1025 | | |