]> The Tcpdump Group git mirrors - libpcap/commit
Turn close_op into cleanup_op; the routine that handles it can also be
authorguy <guy>
Mon, 14 Apr 2008 20:41:51 +0000 (20:41 +0000)
committerguy <guy>
Mon, 14 Apr 2008 20:41:51 +0000 (20:41 +0000)
commitcfa5a9af6cc58e5e8fcebfbe037f8697b3d43dae
tree707b2addc8fc6002005b4c7a3c35eb0059e47a83
parent89aaa53a748e0e6679f25ba4ad6085ac7cfe9e6b
Turn close_op into cleanup_op; the routine that handles it can also be
used to clean up after a failed pcap_activate() call.  Convert the
existing close_op routines to cleanup_op routines, and use them to clean
up; rename pcap_close_common() to pcap_cleanup_live_common(), and use it
directly if there's no platform-dependent cleanup needed.  That means we
don't have to write the same cleanup code twice (and possibly forget
stuff in the version done on a failed pcap_activate() call).

Have the cleanup routines do whatever is necessary to indicate that
cleanup has been done, and not do any particular cleaning up if it's
already been done (i.e., don't free something if the pointer to it is
null and null out the pointer once it's been freed, don't close an FD if
it's -1 and set it to -1 once it's been closed, etc.).

For device types/platforms where we don't support monitor mode, check
for it and return PCAP_ERROR_RFMON_NOTSUP - but do so after we've
checked whether we can open the device, so we return "no such device" or
"permission denied" rather than "that device doesn't support monitor
mode" if we can't open the device in the first place.

Fix a comment.
18 files changed:
pcap-bpf.c
pcap-bt-linux.c
pcap-dag.c
pcap-dlpi.c
pcap-dos.c
pcap-int.h
pcap-libdlpi.c
pcap-linux.c
pcap-nit.c
pcap-pf.c
pcap-septel.c
pcap-sita.c
pcap-snit.c
pcap-snoop.c
pcap-usb-linux.c
pcap-win32.c
pcap.c
savefile.c