After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 771543 - power: Clamp the battery/mains timeouts
power: Clamp the battery/mains timeouts
Status: RESOLVED FIXED
Product: gnome-settings-daemon
Classification: Core
Component: power
unspecified
Other All
: Normal normal
: ---
Assigned To: gnome-settings-daemon-maint
gnome-settings-daemon-maint
Depends on:
Blocks:
 
 
Reported: 2016-09-16 15:46 UTC by Bastien Nocera
Modified: 2016-10-14 17:11 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
power: Clamp the battery/mains timeouts (1.08 KB, patch)
2016-09-16 15:46 UTC, Bastien Nocera
committed Details | Review

Description Bastien Nocera 2016-09-16 15:46:41 UTC
.
Comment 1 Bastien Nocera 2016-09-16 15:46:46 UTC
Created attachment 335720 [details] [review]
power: Clamp the battery/mains timeouts

As the value can be < 0, make sure that we don't set up timeouts for
negative amounts of time.
Comment 2 Michael Catanzaro 2016-09-16 16:38:12 UTC
Review of attachment 335720 [details] [review]:

::: plugins/power/gsd-power-manager.c
@@ +1717,3 @@
                 timeout_sleep = g_settings_get_int (manager->priv->settings, on_battery ?
                                                     "sleep-inactive-battery-timeout" : "sleep-inactive-ac-timeout");
+                timeout_sleep = CLAMP(timeout_sleep, 0, G_MAXINT);

Missing space? CLAMP (timeout_sleep, 0, G_MAXINT)?
Comment 3 Bastien Nocera 2016-09-20 08:32:45 UTC
(In reply to Michael Catanzaro from comment #2)
> Review of attachment 335720 [details] [review] [review]:
> 
> ::: plugins/power/gsd-power-manager.c
> @@ +1717,3 @@
>                  timeout_sleep = g_settings_get_int
> (manager->priv->settings, on_battery ?
>                                                     
> "sleep-inactive-battery-timeout" : "sleep-inactive-ac-timeout");
> +                timeout_sleep = CLAMP(timeout_sleep, 0, G_MAXINT);
> 
> Missing space? CLAMP (timeout_sleep, 0, G_MAXINT)?

I don't usually have spaces before the parens for macros.
Comment 4 Bastien Nocera 2016-10-14 17:10:55 UTC
Was committed in:
commit a228fd4dc298c02f7c8b359c36f71ba8243f51f5
Author: Bastien Nocera <hadess@hadess.net>
Date:   Fri Sep 16 17:45:38 2016 +0200

    power: Clamp the battery/mains timeouts
    
    As the value can be < 0, make sure that we don't set up timeouts for
    negative amounts of time.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=771543