diff options
author | Freya Murphy <freya@freyacat.org> | 2024-09-22 16:54:14 -0400 |
---|---|---|
committer | Freya Murphy <freya@freyacat.org> | 2024-09-22 16:54:14 -0400 |
commit | fff0444f6c9f666e5956dd9a7f7f2443d6d3d58f (patch) | |
tree | 4f6680dae0b2e7ab5c2bb430afa4846266a48dfe /mld/link.c | |
parent | update readme (diff) | |
download | mips-fff0444f6c9f666e5956dd9a7f7f2443d6d3d58f.tar.gz mips-fff0444f6c9f666e5956dd9a7f7f2443d6d3d58f.tar.bz2 mips-fff0444f6c9f666e5956dd9a7f7f2443d6d3d58f.zip |
make mld file executable
Diffstat (limited to '')
-rw-r--r-- | mld/link.c | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -7,6 +7,7 @@ #include <string.h> #include <sys/stat.h> #include <melf.h> +#include <fcntl.h> #include "link.h" #include "mips.h" @@ -573,7 +574,13 @@ static int write_file(struct linker *linker) extern char *current_file; current_file = linker->args->out_file; - FILE *out = fopen(linker->args->out_file, "w"); + int fd = open(linker->args->out_file, O_RDWR | O_CREAT, 0711); + if (fd < 0) { + PERROR("cannot write"); + return M_ERROR; + } + + FILE *out = fdopen(fd, "w"); if (out == NULL) { PERROR("cannot write"); return M_ERROR; |