Hi,
I got some bug reports and unwanted behavior by resume. The problem
boiled down to the fact that resume treats 'no image in partition' as a
regular, while it is of course expected behavior on a normal boot.
Some symptoms that will be fixed by these patches
- resume sets console loglevel to some high value on fail (hence also
on normal boot)
- On normal boot splash gets started really short, just on and off.
First patch is somewhat unrelated. While fixing this I was trying to
get the logic of read_image(). The last part is unnecessary complex. The
if(!error || !ret) should always be true. The only reason I can think
of is reboot() failing. This patch just removes that `if' and adds
some protection for a failing reboot();
Index: resume.c
===================================================================
RCS file: /cvsroot/suspend/suspend/resume.c,v
retrieving revision 1.37
diff -u -r1.37 resume.c
--- resume.c 3 Dec 2006 11:29:59 -0000 1.37
+++ resume.c 15 Jan 2007 15:01:53 -0000
@@ -669,31 +669,35 @@
if (ret) {
close(fd);
reboot();
+ fprintf(stderr,"resume: Reboot failed, please reboot it
manually.\n");
+ while(1);
}
}
- if (!error || !ret) {
- if (!error && verify_checksum) {
- md5_finish_ctx(&handle.ctx, checksum);
- if (memcmp(orig_checksum, checksum, 16)) {
- fprintf(stderr,"resume: MD5 checksum does not
match\n");
- fprintf(stderr,"resume: Computed MD5 checksum
%s\n",
- print_checksum(buffer, checksum));
- error = -EINVAL;
- }
+
+ /* I guess this is after the 'continue boot'-question because
+ * there is no sense in not reseting the signature on error */
+ if (!error && verify_checksum) {
+ md5_finish_ctx(&handle.ctx, checksum);
+ if (memcmp(orig_checksum, checksum, 16)) {
+ fprintf(stderr,"resume: MD5 checksum does not match\n");
+ fprintf(stderr,"resume: Computed MD5 checksum %s\n",
+ print_checksum(buffer, checksum));
+ error = -EINVAL;
}
- /* Reset swap signature now */
- memcpy(swsusp_header.sig, swsusp_header.orig_sig, 10);
- if (lseek(fd, shift, SEEK_SET) != shift) {
- error = -EIO;
- } else {
- ret = write(fd, &swsusp_header, size);
- if (ret != size) {
- error = ret < 0 ? -errno : -EIO;
- fprintf(stderr,
- "resume: Could not restore the
partition header\n");
- }
+ }
+ /* Reset swap signature now */
+ memcpy(swsusp_header.sig, swsusp_header.orig_sig, 10);
+ if (lseek(fd, shift, SEEK_SET) != shift) {
+ error = -EIO;
+ } else {
+ ret = write(fd, &swsusp_header, size);
+ if (ret != size) {
+ error = ret < 0 ? -errno : -EIO;
+ fprintf(stderr,
+ "resume: Could not restore the partition
header\n");
}
}
+
fsync(fd);
close(fd);
#ifdef CONFIG_ENCRYPT
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Suspend-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/suspend-devel