Results 1 to 3 of 3
Hi,
What happens if an open port does not get closed before application exits?
It appears that when my application exits via an abnormal way[*], the next
time I run ...
- 12-04-2008 #1Just Joined!
- Join Date
- Dec 2008
- Posts
- 10
What if open port not closed?
Hi,
What happens if an open port does not get closed before application exits?
It appears that when my application exits via an abnormal way[*], the next
time I run the application, I get errno #9 ("invalid file descriptor"?)
on an ioctl(fd, ...) call even though I don't get an error while acquiring
the fd via open(port, ...) before I call the ioctl(fd, ...) function.
If the application exits properly, it executes a close(fd) before terminating
and the problem is not seen however many times you invoke it.
I understand that there is a limit to the file descriptors but I most definitely
don't reach that, and if I did, I would expect an error in
fd = open(port,...) call.
Thank you.
lu
[*] - e.g. via a kill cmd from another shell.
- 12-05-2008 #2
If you program aborts abnormally, the kernel will eventually close the port.
But this may take some time, but usually less than a minute, until the port is reusable.
With
Signal Handling - The GNU C Library
the application can close() even if it receives a kill signal.Debian GNU/Linux -- You know you want it.
- 12-07-2008 #3Linux User
- Join Date
- Mar 2008
- Posts
- 287
An open port can be exploited by blackhat warriors using applications to probe all of your ports. In fact there are bots which float about waiting to find someone with open ports to be used as pseudo originators of spam.
Suggest you examine your inetd.conf (Slackware) or whatever your system calls it and close ports


Reply With Quote