On Thursday, 16 August 2007 05:38, Alon Bar-Lev wrote:
> On 8/15/07, Rafael J. Wysocki <[EMAIL PROTECTED]> wrote:
> > On Saturday, 11 August 2007 21:08, Alon Bar-Lev wrote:
> > >
> > > Hello,
> > >
> > > Current implementation does not cleanup console settings if abort was
> > > selected by user.
> > > This should fix it.
> >
> > I prefer the appended patch.
> 
> One of the key rules of procedural programming:
> Don't write the same code at different places...
> The same for memory pool size and termination handlers...
> If someone will add a new initialization/cleanup to this function you
> will end up
> with the same bug again and again.

Great theory.

Still, your patch is _functionally_ wrong and mine is functionally correct.

The appended one is probably nicer, though.

Greetings,
Rafael

---
 suspend.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Index: suspend/suspend.c
===================================================================
--- suspend.orig/suspend.c
+++ suspend/suspend.c
@@ -510,7 +510,8 @@ static int save_image(struct swap_map_ha
                                        case ABORT_KEY_CODE:
                                                if (abort_possible) {
                                                        printf(" aborted!\n");
-                                                       return -EINTR;
+                                                       error = -EINTR;
+                                                       goto Exit;
                                                }
                                        break;
                                        case REBOOT_KEY_CODE:
@@ -531,6 +532,7 @@ static int save_image(struct swap_map_ha
        if (!error)
                printf(" done (%u pages)\n", nr_pages);
 
+Exit:
        if (abort_possible)
                splash.restore_abort(&savedtrm);
 

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Suspend-devel mailing list
Suspend-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/suspend-devel

Reply via email to