* Fix incorrect error message in case input file opening fails
* Don't close files in case the pointers are invalid
Signed-off-by: David Bauer <mail@david-bauer.net>
include $(TOPDIR)/rules.mk
PKG_NAME:=fritz-tools
include $(TOPDIR)/rules.mk
PKG_NAME:=fritz-tools
CMAKE_INSTALL:=1
include $(INCLUDE_DIR)/package.mk
CMAKE_INSTALL:=1
include $(INCLUDE_DIR)/package.mk
if (argc > 1 && optind <= argc) {
in = fopen(argv[optind], "r");
if (!in) {
if (argc > 1 && optind <= argc) {
in = fopen(argv[optind], "r");
if (!in) {
- perror("Failed to create output file");
+ perror("Failed to open input file");
- fclose(in);
- fclose(out);
+ if (in)
+ fclose(in);
+ if (out)
+ fclose(out);