make mld file executable
This commit is contained in:
parent
30081a352e
commit
fff0444f6c
1 changed files with 8 additions and 1 deletions
|
@ -7,6 +7,7 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <melf.h>
|
#include <melf.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
|
||||||
#include "link.h"
|
#include "link.h"
|
||||||
#include "mips.h"
|
#include "mips.h"
|
||||||
|
@ -573,7 +574,13 @@ static int write_file(struct linker *linker)
|
||||||
extern char *current_file;
|
extern char *current_file;
|
||||||
current_file = linker->args->out_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) {
|
if (out == NULL) {
|
||||||
PERROR("cannot write");
|
PERROR("cannot write");
|
||||||
return M_ERROR;
|
return M_ERROR;
|
||||||
|
|
Loading…
Reference in a new issue