apps/sym: Read from the end of the file

This commit is contained in:
apio 2022-10-15 17:45:53 +02:00
parent 68403dc029
commit d30010d524
2 changed files with 9 additions and 5 deletions

View File

@ -141,5 +141,9 @@ int main()
fclose(new_stderr); fclose(new_stderr);
return 0; execv("/bin/sym", NULL);
perror("execv"); // If we're here, execv failed
return 1;
} }

View File

@ -4,7 +4,7 @@
int main() int main()
{ {
sleep(6); sleep(2);
FILE* syms = fopen("/sys/moon.sym", "r"); FILE* syms = fopen("/sys/moon.sym", "r");
if (!syms) if (!syms)
@ -13,15 +13,15 @@ int main()
return 1; return 1;
} }
char buf[1025]; char buf[1200];
if (fseek(syms, 8000, SEEK_SET) < 0) if (fseek(syms, -1199, SEEK_END) < 0)
{ {
perror("fseek"); perror("fseek");
return 1; return 1;
} }
size_t nread = fread(buf, 1024, 1, syms); size_t nread = fread(buf, 1199, 1, syms);
if (ferror(syms)) if (ferror(syms))
{ {
perror("fread"); perror("fread");