00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #include "streamClose.h"
00011 #include "miscServerFunct.h"
00012 #include "rsGlobalExtern.h"
00013
00014 int
00015 rsStreamClose (rsComm_t *rsComm, fileCloseInp_t *streamCloseInp)
00016 {
00017 int fileInx = streamCloseInp->fileInx;
00018 int status;
00019
00020 if (fileInx < 3 || fileInx >= NUM_FILE_DESC) {
00021 rodsLog (LOG_ERROR,
00022 "rsStreamClose: fileInx %d out of range", fileInx);
00023 return (SYS_FILE_DESC_OUT_OF_RANGE);
00024 }
00025 if (FileDesc[fileInx].inuseFlag != FD_INUSE) return SYS_BAD_FILE_DESCRIPTOR;
00026
00027 if (FileDesc[fileInx].fileName == NULL) return SYS_INVALID_FILE_PATH;
00028 if (strcmp (FileDesc[fileInx].fileName, STREAM_FILE_NAME) != 0) {
00029 rodsLog (LOG_ERROR,
00030 "rsStreamClose: fileName %s is invalid for stream",
00031 FileDesc[fileInx].fileName);
00032 return SYS_INVALID_FILE_PATH;
00033 }
00034 status = rsFileClose (rsComm, streamCloseInp);
00035
00036 return status;
00037 }
00038