[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
swapon using _SERVERS_DEFPAGER
From: |
James Morrison |
Subject: |
swapon using _SERVERS_DEFPAGER |
Date: |
Wed, 26 Jun 2002 10:11:22 -0700 (PDT) |
Hi,
I'm looking at [hurd]/sutils/swapon, and it doesn't seem to be using
_SERVERS_DEFPAGER correctly.
Here is the code:
if (def_pager == MACH_PORT_NULL)
{
mach_port_t host;
err = get_privileged_ports (&host, &dev_master);
if (err == EPERM)
{
/* We are not root, so try opening the /servers node. */
def_pager = file_name_lookup (_SERVERS_DEFPAGER, O_WRITE, 0);
if (def_pager == MACH_PORT_NULL)
{
error (11, errno, _SERVERS_DEFPAGER);
return 0;
}
}
Why are we checking err unconditionally here, this just makes the above code
completly useless, because the call to get_privileged_ports will fail, then
_SERVERS_DEFPAGER is looked up, but err is not set to 0 again, so the following
if succeeds.
if (err)
error (12, err, "Cannot get privileged ports");
err = vm_set_default_memory_manager (host, &def_pager);
mach_port_deallocate (mach_task_self (), host);
if (err)
error (13, err, "Cannot get default pager port");
if (def_pager == MACH_PORT_NULL)
Also, if swapon can now be used by a user to add swap space, a swap file
perhaps
, shouldn't swapon be moved to [hurd]/utils?
=====
James Morrison
University of Waterloo
Computer Science - Digital Hardware
2A co-op
http://hurd.dyndns.org
Anyone referring to this as 'Open Source' shall be eaten by a GNU
__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com
- swapon using _SERVERS_DEFPAGER,
James Morrison <=