diff --git a/CMakeLists.txt b/CMakeLists.txt index 5bf1d36..cd70f5f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -122,10 +122,10 @@ if (WITH_SIST2) target_compile_options(sist2 PRIVATE -# -Ofast + -Ofast # -march=native -# -fno-stack-protector -# -fomit-frame-pointer + -fno-stack-protector + -fomit-frame-pointer ) TARGET_LINK_LIBRARIES( diff --git a/src/cli.c b/src/cli.c index 74fa910..9ed2918 100644 --- a/src/cli.c +++ b/src/cli.c @@ -126,7 +126,12 @@ int index_args_validate(index_args_t *args, int argc, const char **argv) { } args->script = malloc(info.st_size + 1); - read(fd, args->script, info.st_size); + res = read(fd, args->script, info.st_size); + if (res == -1) { + fprintf(stderr, "Error reading script file '%s': %s\n", args->script_path, strerror(errno)); + return 1; + } + *(args->script + info.st_size) = '\0'; close(fd); }