Skip to content

Commit

Permalink
sysctl: A more obvious version of grab_header.
Browse files Browse the repository at this point in the history
Instead of relying on sysct_head_next(NULL) to magically
return the right header for the root directory instead
explicitly transform NULL into the root directories header.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
  • Loading branch information
Eric W. Biederman committed Jan 25, 2012
1 parent 8d6ecfc commit 3cc3e04
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions fs/proc/proc_sysctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -267,10 +267,10 @@ static struct ctl_table *find_in_table(struct ctl_table *p, struct qstr *name)

static struct ctl_table_header *grab_header(struct inode *inode)
{
if (PROC_I(inode)->sysctl)
return sysctl_head_grab(PROC_I(inode)->sysctl);
else
return sysctl_head_next(NULL);
struct ctl_table_header *head = PROC_I(inode)->sysctl;
if (!head)
head = &root_table_header;
return sysctl_head_grab(head);
}

static struct dentry *proc_sys_lookup(struct inode *dir, struct dentry *dentry,
Expand Down

0 comments on commit 3cc3e04

Please sign in to comment.