1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-24 04:33:24 +00:00

- 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)
This commit is contained in:
Maxim Sobolev 2002-01-14 18:05:35 +00:00
parent f80e46e387
commit 6f15105d69
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=53065
6 changed files with 69 additions and 0 deletions

View File

@ -7,6 +7,7 @@
PORTNAME= gnomeapplets
PORTVERSION= 1.4.0.4
PORTREVISION= 1
CATEGORIES= x11 gnome
MASTER_SITES= ${MASTER_SITE_GNOME}
MASTER_SITE_SUBDIR= stable/sources/gnome-applets

View File

@ -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;
}

View File

@ -7,6 +7,7 @@
PORTNAME= gnomeapplets
PORTVERSION= 1.4.0.4
PORTREVISION= 1
CATEGORIES= x11 gnome
MASTER_SITES= ${MASTER_SITE_GNOME}
MASTER_SITE_SUBDIR= stable/sources/gnome-applets

View File

@ -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;
}

View File

@ -7,6 +7,7 @@
PORTNAME= gnomeapplets
PORTVERSION= 1.4.0.4
PORTREVISION= 1
CATEGORIES= x11 gnome
MASTER_SITES= ${MASTER_SITE_GNOME}
MASTER_SITE_SUBDIR= stable/sources/gnome-applets

View File

@ -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;
}