aboutsummaryrefslogtreecommitdiff
path: root/src/program.c
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2022-02-11 17:41:33 +0100
committerdec05eba <dec05eba@protonmail.com>2022-02-11 17:41:33 +0100
commit6cad09ec9c801e90d41f53ebcd673ef89050cc86 (patch)
treea57b30c824c663ed7730a6df6f2478a4a5b500e8 /src/program.c
parent8d1532abb6f7441e00ffbc7ed4d0231e5023e19a (diff)
Check if file to read is really a fileHEADmaster
Diffstat (limited to 'src/program.c')
-rw-r--r--src/program.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/program.c b/src/program.c
index e53eb6b..e163b9b 100644
--- a/src/program.c
+++ b/src/program.c
@@ -871,12 +871,14 @@ int amal_program_save(amal_program *self, const char *filepath) {
int err = 0;
FILE *file = fopen(filepath, "wb");
if(!file) {
- err = -errno;
+ perror(filepath);
+ err = -1;
goto cleanup;
}
if(fwrite(self->data.data, 1, self->data.size, file) != self->data.size) {
- err = -errno;
+ fprintf(stderr, "Failed to write %zu bytes to %s\n", self->data.size, filepath);
+ err = -1;
goto cleanup;
}