summaryrefslogtreecommitdiff
path: root/batmon/batmon.c
diff options
context:
space:
mode:
authorJeff Garzik <jgarzik@src.gnome.org>1998-12-25 03:40:38 +0000
committerJeff Garzik <jgarzik@src.gnome.org>1998-12-25 03:40:38 +0000
commit76b528f845916166c2e6d16795006185408257c3 (patch)
treef8a21bb1361b764640d113da4132bf75856713e6 /batmon/batmon.c
parent2a61b52d2e11063f83a5d73ce1bf3114a0c496dd (diff)
Merge some GNOME_STABLE changes into HEAD.
Diffstat (limited to 'batmon/batmon.c')
-rw-r--r--batmon/batmon.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/batmon/batmon.c b/batmon/batmon.c
index 596cb6bc3..8834d50e8 100644
--- a/batmon/batmon.c
+++ b/batmon/batmon.c
@@ -192,7 +192,7 @@ batmon_timeout_callback (gpointer *data)
batpct = aip.ai_batt_life;
- sprintf(str, "%d.%d", aip.ai_major, aip.ai_minor);
+ g_snprintf(str, sizeof(str), "%d.%d", aip.ai_major, aip.ai_minor);
gtk_label_set (GTK_LABEL (bioslabel), str);
@@ -237,15 +237,19 @@ batmon_timeout_callback (gpointer *data)
(gfloat) batpct / 100);
if (batmin == -1)
{
- strcpy(str, _("unknown minutes of battery."));
- sprintf(tipstr, _("unknown minutes of battery (%d%%)"),
- batpct);
+ strncpy(str, sizeof(str), _("unknown minutes of battery."));
+ str[sizeof(str) - 1] = 0;
+ g_snprintf(tipstr, sizeof(tipstr),
+ _("unknown minutes of battery (%d%%)"),
+ batpct);
}
else if (batmin < 100000000)
{
- sprintf (str, _("%d minutes of battery"), batmin);
- sprintf(tipstr, _("%d minutes of battery (%d%%)"),
- batmin, batpct);
+ g_snprintf (str, sizeof(str),
+ _("%d minutes of battery"), batmin);
+ g_snprintf(tipstr, sizeof(tipstr),
+ _("%d minutes of battery (%d%%)"),
+ batmin, batpct);
}
else { /* would have to be an error */
g_warning (_("More than 100,000,000 minutes of battery life?!?"));