diff options
Diffstat (limited to 'seitan.c')
-rw-r--r-- | seitan.c | 21 |
1 files changed, 21 insertions, 0 deletions
@@ -195,6 +195,24 @@ static int recvfd(int sockfd) return fd; } +static void gluten_relocate(struct gluten *g) +{ + unsigned i; + + for (i = 0; i < 256; i++) { + void **p; + + switch (g->header.relocation[i].type) { + case OFFSET_DATA: + p = gluten_write_ptr(g, g->header.relocation[i]); + *p = (intptr_t)*p + g->data; + break; + default: + ; + } + } +} + int main(int argc, char **argv) { char req_b[BUFSIZ]; @@ -212,11 +230,14 @@ int main(int argc, char **argv) arguments.uid = getuid(); arguments.gid = getgid(); parse(argc, argv, &arguments); + fd = open(arguments.input_file, O_CLOEXEC | O_RDONLY); if (read(fd, &g, sizeof(g)) != sizeof(g)) die("Failed to read gluten file"); close(fd); + gluten_relocate(&g); + if (arguments.pid > 0) { if ((pidfd = syscall(SYS_pidfd_open, arguments.pid, 0)) < 0) die(" pidfd_open"); |