diff options
author | Sean Bright <sean@malleable.com> | 2009-04-21 13:44:58 +0000 |
---|---|---|
committer | Sean Bright <sean@malleable.com> | 2009-04-21 13:44:58 +0000 |
commit | e80dab93186b6e019d5fff0a8d780310c6678062 (patch) | |
tree | b34340bfcfe725317051c934a56796f33f844ca5 | |
parent | e597312384e0641a995e18d687746b26a181e46a (diff) |
Correct error check for fopen() calls in dahdi_monitor.c.
dahdi_monitor.c was checking for an error calling fopen() by determining if the
return value was less than 0. fopen(), however, returns a FILE * and returns
NULL on failure.
(closes issue #14894)
Reported by: gknispel_proformatique
Patches:
dahdi_monitor_fix_check_fopen_result.patch uploaded by gknispel (license 261)
git-svn-id: http://svn.asterisk.org/svn/dahdi/tools/trunk@6421 a0bf4364-ded3-4de4-8d8a-66a801d63aff
-rw-r--r-- | dahdi_monitor.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/dahdi_monitor.c b/dahdi_monitor.c index 9af992f..d1920af 100644 --- a/dahdi_monitor.c +++ b/dahdi_monitor.c @@ -343,7 +343,7 @@ int main(int argc, char *argv[]) fprintf(stderr, "Cannot specify option '%c' more than once.\n", opt); exit(EXIT_FAILURE); } - if ((ofh[MON_BRX] = fopen(optarg, "w")) < 0) { + if ((ofh[MON_BRX] = fopen(optarg, "w")) == NULL) { fprintf(stderr, "Could not open %s for writing: %s\n", optarg, strerror(errno)); exit(EXIT_FAILURE); } @@ -359,7 +359,7 @@ int main(int argc, char *argv[]) fprintf(stderr, "Cannot specify option '%c' more than once.\n", opt); exit(EXIT_FAILURE); } - if ((ofh[MON_PRE_BRX] = fopen(optarg, "w")) < 0) { + if ((ofh[MON_PRE_BRX] = fopen(optarg, "w")) == NULL) { fprintf(stderr, "Could not open %s for writing: %s\n", optarg, strerror(errno)); exit(EXIT_FAILURE); } @@ -376,7 +376,7 @@ int main(int argc, char *argv[]) fprintf(stderr, "Cannot specify option '%c' more than once.\n", opt); exit(EXIT_FAILURE); } - if ((ofh[MON_BRX] = fopen(optarg, "w")) < 0) { + if ((ofh[MON_BRX] = fopen(optarg, "w")) == NULL) { fprintf(stderr, "Could not open %s for writing: %s\n", optarg, strerror(errno)); exit(EXIT_FAILURE); } @@ -393,7 +393,7 @@ int main(int argc, char *argv[]) fprintf(stderr, "Cannot specify option '%c' more than once.\n", opt); exit(EXIT_FAILURE); } - if ((ofh[MON_PRE_BRX] = fopen(optarg, "w")) < 0) { + if ((ofh[MON_PRE_BRX] = fopen(optarg, "w")) == NULL) { fprintf(stderr, "Could not open %s for writing: %s\n", optarg, strerror(errno)); exit(EXIT_FAILURE); } @@ -411,7 +411,7 @@ int main(int argc, char *argv[]) fprintf(stderr, "Cannot specify option '%c' more than once.\n", opt); exit(EXIT_FAILURE); } - if ((ofh[MON_TX] = fopen(optarg, "w")) < 0) { + if ((ofh[MON_TX] = fopen(optarg, "w")) == NULL) { fprintf(stderr, "Could not open %s for writing: %s\n", optarg, strerror(errno)); exit(EXIT_FAILURE); } @@ -428,7 +428,7 @@ int main(int argc, char *argv[]) fprintf(stderr, "Cannot specify option '%c' more than once.\n", opt); exit(EXIT_FAILURE); } - if ((ofh[MON_PRE_TX] = fopen(optarg, "w")) < 0) { + if ((ofh[MON_PRE_TX] = fopen(optarg, "w")) == NULL) { fprintf(stderr, "Could not open %s for writing: %s\n", optarg, strerror(errno)); exit(EXIT_FAILURE); } @@ -446,7 +446,7 @@ int main(int argc, char *argv[]) fprintf(stderr, "Cannot specify option '%c' more than once.\n", opt); exit(EXIT_FAILURE); } - if ((ofh[MON_STEREO] = fopen(optarg, "w")) < 0) { + if ((ofh[MON_STEREO] = fopen(optarg, "w")) == NULL) { fprintf(stderr, "Could not open %s for writing: %s\n", optarg, strerror(errno)); exit(EXIT_FAILURE); } @@ -463,7 +463,7 @@ int main(int argc, char *argv[]) fprintf(stderr, "Cannot specify option '%c' more than once.\n", opt); exit(EXIT_FAILURE); } - if ((ofh[MON_PRE_STEREO] = fopen(optarg, "w")) < 0) { + if ((ofh[MON_PRE_STEREO] = fopen(optarg, "w")) == NULL) { fprintf(stderr, "Could not open %s for writing: %s\n", optarg, strerror(errno)); exit(EXIT_FAILURE); } |