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