summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--loader2/modules.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/loader2/modules.c b/loader2/modules.c
index 1e6dd17f2..3c343066a 100644
--- a/loader2/modules.c
+++ b/loader2/modules.c
@@ -715,15 +715,18 @@ char * getModuleLocation(int version) {
struct stat sb;
int fd;
- stat(archfile, &sb);
- arch = malloc(sb.st_size + 1);
-
- fd = open(archfile, O_RDONLY);
- read(fd, arch, sb.st_size);
- if (arch[sb.st_size -1 ] == '\n')
- sb.st_size--;
- arch[sb.st_size] = '\0';
- close(fd);
+ if (!stat(archfile, &sb)) {
+ arch = malloc(sb.st_size + 1);
+
+ fd = open(archfile, O_RDONLY);
+ read(fd, arch, sb.st_size);
+ if (arch[sb.st_size -1 ] == '\n')
+ sb.st_size--;
+ arch[sb.st_size] = '\0';
+ close(fd);
+ } else {
+ arch = strdup(u.machine);
+ }
}
if (version == 1) {