Bug 25675

Summary: [PATCH] can_hibernate property should be false when no swap exists
Product: upower Reporter: Debbie Beliveau <debbie.beliveau>
Component: generalAssignee: Richard Hughes <richard>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: low    
Version: unspecified   
Hardware: Other   
OS: All   
URL: https://bugs.launchpad.net/ubuntu/+source/devicekit-power/+bug/497130
Whiteboard:
i915 platform: i915 features:
Attachments: Have dkp_daemon_check_swap function 1st check if swap exists before determining how much is free

Description Debbie Beliveau 2009-12-16 08:23:31 UTC
Created attachment 32123 [details] [review]
Have dkp_daemon_check_swap function 1st  check if swap exists before determining how much is free

dkp_client_can_hibernate can return true even if the machine has no swap partition.  When determining the value of its can_hibernate property, devicekit-power checks if the kernel supports hibernate and whether there is enough swap space available to perform a hibernate.  However, it does not seem to account for the possibility that a machine may not have a swap partition even though its kernel supports it.  In this case, devicekit-power detects that the kernel supports hibernate and treats the swap space as completely available (therefore dkp_client_can_hibernate returns true).  The attached patch modifies devicekit-power to first check if a swap partition exists before calculating how much is available.
Comment 1 Richard Hughes 2009-12-16 08:30:24 UTC
Thanks for the patch, applied.

commit bbb102c394eff71d84801b48b11e022b1fecb497
Author: Debbie Beliveau <debbie.beliveau@gmail.com>
Date:   Wed Dec 16 16:29:29 2009 +0000

    Check if swap exists before determining how much is free
    
    Signed-off-by: Richard Hughes <richard@hughsie.com>

:100644 100644 eb16a63... 47d84d5... M  src/dkp-daemon.c

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.