From d30010d524b600919522d8ca72e1b7683ba0e981 Mon Sep 17 00:00:00 2001 From: apio Date: Sat, 15 Oct 2022 17:45:53 +0200 Subject: [PATCH] apps/sym: Read from the end of the file --- apps/src/init.c | 6 +++++- apps/src/sym.c | 8 ++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/apps/src/init.c b/apps/src/init.c index e4b2fad1..f83fd1f7 100644 --- a/apps/src/init.c +++ b/apps/src/init.c @@ -141,5 +141,9 @@ int main() fclose(new_stderr); - return 0; + execv("/bin/sym", NULL); + + perror("execv"); // If we're here, execv failed + + return 1; } diff --git a/apps/src/sym.c b/apps/src/sym.c index f170c691..89fe3a7a 100644 --- a/apps/src/sym.c +++ b/apps/src/sym.c @@ -4,7 +4,7 @@ int main() { - sleep(6); + sleep(2); FILE* syms = fopen("/sys/moon.sym", "r"); if (!syms) @@ -13,15 +13,15 @@ int main() return 1; } - char buf[1025]; + char buf[1200]; - if (fseek(syms, 8000, SEEK_SET) < 0) + if (fseek(syms, -1199, SEEK_END) < 0) { perror("fseek"); return 1; } - size_t nread = fread(buf, 1024, 1, syms); + size_t nread = fread(buf, 1199, 1, syms); if (ferror(syms)) { perror("fread");