* Ensure all fopen check for NULL (not -1)

* Improve test-perf cycles
This commit is contained in:
Olof hagsand 2020-12-07 09:56:07 +01:00
parent 344dcacf6f
commit e1b94d94d2
20 changed files with 24 additions and 23 deletions

View file

@ -251,7 +251,7 @@ main(int argc, char **argv)
}
if (argc == 2){
FILE *fp;
if ((fp = fopen(xmlfilename, "r")) < 0){
if ((fp = fopen(xmlfilename, "r")) == NULL){
clicon_err(OE_UNIX, errno, "fopen(%s)", xmlfilename);
goto done;
}

View file

@ -135,7 +135,7 @@ main(int argc,
break;
case 'f': /* XML file */
filename = optarg;
if ((fp = fopen(filename, "r")) < 0){
if ((fp = fopen(filename, "r")) == NULL){
clicon_err(OE_UNIX, errno, "fopen(%s)", optarg);
goto done;
}

View file

@ -138,7 +138,7 @@ main(int argc,
usage(argv[0]);
}
if (input_filename){
if ((fp = fopen(input_filename, "r")) < 0){
if ((fp = fopen(input_filename, "r")) == NULL){
clicon_err(OE_YANG, errno, "open(%s)", input_filename);
goto done;
}

View file

@ -263,7 +263,7 @@ main(int argc,
* Always validated
*/
if (top_input_filename){
if ((tfp = fopen(top_input_filename, "r")) < 0){
if ((tfp = fopen(top_input_filename, "r")) == NULL){
clicon_err(OE_YANG, errno, "fopen(%s)", top_input_filename);
goto done;
}
@ -288,7 +288,7 @@ main(int argc,
xt = xbot;
}
if (input_filename){
if ((fp = fopen(input_filename, "r")) < 0){
if ((fp = fopen(input_filename, "r")) == NULL){
clicon_err(OE_YANG, errno, "open(%s)", input_filename);
goto done;
}

View file

@ -168,7 +168,7 @@ main(int argc,
break;
case 'f': /* XML file */
filename = optarg;
if ((fp = fopen(filename, "r")) < 0){
if ((fp = fopen(filename, "r")) == NULL){
clicon_err(OE_UNIX, errno, "open(%s)", argv[1]);
goto done;
}