summaryrefslogtreecommitdiff
path: root/sc/sc.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'sc/sc.cpp')
-rw-r--r--sc/sc.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/sc/sc.cpp b/sc/sc.cpp
index 0f61fdf..3c39b0c 100644
--- a/sc/sc.cpp
+++ b/sc/sc.cpp
@@ -62,10 +62,7 @@ bool rf(const char* n, char*& buf, size_t& size) {
rewind(f);
buf = new char[size + 1];
buf[size] = 0;
- if (size != fread(buf, 1, size, f)) {
- delete[] buf;
- return false;
- }
+ buf[fread(buf, 1, size, f)] = 0;
return true;
}
@@ -708,6 +705,7 @@ int main(int argc, const char** argv) {
Desc desc;
if (argc < 3) {
print_err("Usage: %s infile outfile.\n", argv[0]);
+ return 1;
}
if (!rf(argv[1], src, src_size)) {
print_err("Failed to read %s\n", argv[1]);