Commit d406c5eb authored by Lionel Gauthier's avatar Lionel Gauthier

check file descriptor

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@7261 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent 0454e940
...@@ -295,14 +295,16 @@ void msc_log_declare_proto( ...@@ -295,14 +295,16 @@ void msc_log_declare_proto(
uint64_t local_msc_event_counter = msc_event_counter; uint64_t local_msc_event_counter = msc_event_counter;
msc_event_counter++; msc_event_counter++;
if ((protoP >= MIN_MSC_PROTOS) && (protoP < MAX_MSC_PROTOS)) { if ((protoP >= MIN_MSC_PROTOS) && (protoP < MAX_MSC_PROTOS)) {
if (msc_fd[protoP] != NULL) {
rv = fprintf(msc_fd[protoP], "%"PRIu64" [PROTO] %d %s\n", local_msc_event_counter, protoP, &msc_proto2str[protoP][0]); rv = fprintf(msc_fd[protoP], "%"PRIu64" [PROTO] %d %s\n", local_msc_event_counter, protoP, &msc_proto2str[protoP][0]);
if (rv < 0) { if (rv < 0) {
fprintf(stderr, "Error while declaring new protocol in MSC log file: %s", strerror(errno)); fprintf(stderr, "Error while declaring new protocol in MSC log file: %s", strerror(errno));
} }
rv = fflush(msc_fd[protoP]); rv = fflush(msc_fd[protoP]);
if (rv != 0) { if (rv != 0) {
fprintf(stderr, "Error while flushing stream of MSC log file: %s", strerror(errno)); fprintf(stderr, "Error while flushing stream of MSC log file: %s", strerror(errno));
} }
}
} }
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
...@@ -320,7 +322,7 @@ void msc_log_event( ...@@ -320,7 +322,7 @@ void msc_log_event(
if ((protoP < MIN_MSC_PROTOS) || (protoP >= MAX_MSC_PROTOS)) { if ((protoP < MIN_MSC_PROTOS) || (protoP >= MAX_MSC_PROTOS)) {
return; return;
} }
if (msc_fd != NULL) { if (msc_fd[protoP] != NULL) {
rv = fprintf(msc_fd[protoP], "%"PRIu64" [EVENT] %d ", local_msc_event_counter, protoP); rv = fprintf(msc_fd[protoP], "%"PRIu64" [EVENT] %d ", local_msc_event_counter, protoP);
if (rv < 0) { if (rv < 0) {
fprintf(stderr, "Error while logging MSC event : %s", &msc_proto2str[protoP][0]); fprintf(stderr, "Error while logging MSC event : %s", &msc_proto2str[protoP][0]);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment