chpax incorrect errormsg output fix (1 line to remove)

Discuss usability issues, general maintenance, and general support issues for a grsecurity-enabled system.

chpax incorrect errormsg output fix (1 line to remove)

Postby mayhem » Sun Dec 08, 2002 9:14 pm

Hello all,

To have some more explicit error handling message (in case open() failed), just remove the failing close(fd) call in chpax.c at this place :

switch (read_header(current, O_RDWR))
{
case 1:
close(fd); <=
perror(current);
error = 1;
continue ;
(...)

because read_header() returning 1 means the file wasnt opened succesfully, so close(fd)
is trying to close an invalid file descriptor, which has the consequence to print a an incorrect error message on the terminal (indicating the close error instead of the open error) .

Sorry if this disturbed anyone .

mayhem
mayhem
 
Posts: 2
Joined: Sun Dec 08, 2002 9:05 pm

Return to grsecurity support