# HG changeset patch # User Paper <37962225+mrpapersonic@users.noreply.github.com> # Date 1643254361 18000 # Node ID 9d862edfd3ccd742180c6ff6620779318f1305cb # Parent bd392e82001c08a5b0626794d99a35d4c8a427c4 fix fgetc() call diff -r bd392e82001c -r 9d862edfd3cc src/main.c --- a/src/main.c Wed Jan 26 21:57:01 2022 -0500 +++ b/src/main.c Wed Jan 26 22:32:41 2022 -0500 @@ -92,7 +92,7 @@ strncpy(args.output, optarg, sizeof(args.input)-1); break; case 'v': - args.version = abs(atoi(strcpy(optarg))); /* abs() for possible negative inputs */ + args.version = abs(atoi(strdup(optarg))); /* abs() for possible negative inputs */ break; case 't': strncpy(args.type, optarg, sizeof(args.input)-1); @@ -117,7 +117,7 @@ return 1; } FILE* input_file = fopen(args.input, "r"); - if (fgetc() == EOF) { + if (fgetc(input_file) == EOF) { fprintf(stderr, "Input file \"%s\" is empty.", args.input); fclose(input_file); return 1;