[Pm-utils] [patch] fix pm-reset-swap

Stefan Seyfried seife at suse.de
Tue Mar 13 10:26:15 PDT 2007


Hi,

pm-reset-swap is dangerously broken right now. This is the "rc = 1" hunk.

Additinally, it does not fix userspace suspend images.
The third hunk is more a cosmetic issue, i'm not passionate about it.

Index: src/pm-reset-swap.c
===================================================================
RCS file: /cvs/pm-utils/pm-utils/src/pm-reset-swap.c,v
retrieving revision 1.1
diff -u -p -r1.1 pm-reset-swap.c
--- src/pm-reset-swap.c	29 Jan 2007 21:49:45 -0000	1.1
+++ src/pm-reset-swap.c	20 Feb 2007 17:15:10 -0000
@@ -95,7 +95,8 @@ int check_resume_block(FILE *dev, off_t 
     if (fread(buf, sizeof (char), 10, dev) != 10)
         return -1;
 
-    if (!strncmp(buf, "S1SUSPEND", 9))
+    if (!strncmp(buf, "S1SUSPEND", 9) ||
+        !strncmp(buf, "ULSUSPEND", 9))
         return 1;
 
     return 0;
@@ -148,7 +149,7 @@ int main(int argc, char *argv[])
         fclose(dev);
         return 2;
     }
-    rc = 1;
+
     if (rc == 1) {
         if (clear_resume_block(dev, 0)) {
             fprintf(stderr, "Could not clear swap signature on \"%s\": %m\n",
@@ -156,7 +157,8 @@ int main(int argc, char *argv[])
             fclose(dev);
             return 1;
         }
-    }
+    } else
+        fprintf(stderr, "no suspend signature found\n");
         
     fclose(dev);
     return 0;

-- 
Stefan Seyfried

"Any ideas, John?"
"Well, surrounding them's out." 


More information about the Pm-utils mailing list