summaryrefslogtreecommitdiff
path: root/x11/gnomeapplets/files/patch-battery::read-battery.c
diff options
context:
space:
mode:
authorMaxim Sobolev <sobomax@FreeBSD.org>2002-01-14 18:05:35 +0000
committerMaxim Sobolev <sobomax@FreeBSD.org>2002-01-14 18:05:35 +0000
commit6f15105d69ff49de75650fc14bf558b8b58184c9 (patch)
tree77dc62f2e8e3b0fa4ed638f1e6334ab1447efc14 /x11/gnomeapplets/files/patch-battery::read-battery.c
parentUse correct encoding for Russian and Ukrainian messages (KOI8-R and KOI8-U) (diff)
- Open /dev/apm read-only;
- don't leak file descripton if for fome reasom ioctl(2) on /dev/apm has failed. Submitted by: Anders Andersson <anders@hack.org> (ro /dev/apm) sobomax (descriptor leak)
Diffstat (limited to 'x11/gnomeapplets/files/patch-battery::read-battery.c')
-rw-r--r--x11/gnomeapplets/files/patch-battery::read-battery.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/x11/gnomeapplets/files/patch-battery::read-battery.c b/x11/gnomeapplets/files/patch-battery::read-battery.c
new file mode 100644
index 000000000000..b21c4f82e519
--- /dev/null
+++ b/x11/gnomeapplets/files/patch-battery::read-battery.c
@@ -0,0 +1,22 @@
+
+$FreeBSD$
+
+--- battery/read-battery.c 2002/01/14 14:23:46 1.1
++++ battery/read-battery.c 2002/01/14 14:25:45
+@@ -170,7 +170,7 @@
+ *hours_remaining = -1;
+ *minutes_remaining = 1;
+
+- fd = open(APMDEV, O_RDWR);
++ fd = open(APMDEV, O_RDONLY);
+ if (fd == -1)
+ {
+ g_error (_("Cannot open /dev/apm; can't get data."));
+@@ -179,6 +179,7 @@
+
+ if (ioctl(fd, APMIO_GETINFO, &aip) == -1) {
+ g_error(_("ioctl failed on /dev/apm."));
++ close(fd);
+ return FALSE;
+ }
+