chpax incorrect errormsg output fix (1 line to remove)
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
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