View Single Post
Posts: 1,101 | Thanked: 1,185 times | Joined on Aug 2008 @ Spain
#183
Originally Posted by lma View Post
Or just do the truncation with stuff present in the base install like perl:

Code:
open(Z, "+</usr/share/Diablo-Turbo/backup/zImage-backup") &&
sysseek(Z, 0x2C, 0) &&
sysread(Z, $l, 4) &&
truncate(Z, unpack("L", $l)) &&
close(Z);
(season with appopriate error handling to taste).
I do not do perl, too arcane for me to learn, but I'll happyly use your code snippet.
While you're at it, why don't you add the equivalent of "if filesize(Z)<$l: exit(1)" before truncate?