Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
P
Pcap-Net
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Pcap-Net
Commits
87a83787
Commit
87a83787
authored
Jan 28, 2012
by
Brickner_cp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix double FILE closing.
parent
b5224c38
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
1 addition
and
23 deletions
+1
-23
OfflinePacketCommunicator.cpp
PcapDotNet/src/PcapDotNet.Core/OfflinePacketCommunicator.cpp
+1
-17
OfflinePacketCommunicator.h
PcapDotNet/src/PcapDotNet.Core/OfflinePacketCommunicator.h
+0
-6
No files found.
PcapDotNet/src/PcapDotNet.Core/OfflinePacketCommunicator.cpp
View file @
87a83787
...
...
@@ -17,12 +17,6 @@ void OfflinePacketCommunicator::Transmit(PacketSendBuffer^, bool)
throw
gcnew
InvalidOperationException
(
"Can't transmit queue to an offline device"
);
}
OfflinePacketCommunicator
::~
OfflinePacketCommunicator
()
{
if
(
_file
!=
NULL
)
CloseFile
(
_file
);
}
OfflinePacketCommunicator
::
OfflinePacketCommunicator
(
String
^
filename
)
:
PacketCommunicator
(
OpenFile
(
filename
),
nullptr
)
{
...
...
@@ -41,19 +35,9 @@ pcap_t* OfflinePacketCommunicator::OpenFile(String^ fileName)
pcap_t
*
pcapDescriptor
=
pcap_fopen_offline
(
file
,
errorBuffer
);
if
(
pcapDescriptor
==
NULL
)
{
CloseFil
e
(
file
);
fclos
e
(
file
);
throw
gcnew
InvalidOperationException
(
String
::
Format
(
CultureInfo
::
InvariantCulture
,
"Failed opening file {0}. Error: {1}"
,
fileName
,
gcnew
String
(
errorBuffer
)));
}
_file
=
file
;
return
pcapDescriptor
;
}
// static
void
OfflinePacketCommunicator
::
CloseFile
(
FILE
*
file
)
{
int
result
=
fclose
(
file
);
if
(
result
!=
0
)
throw
gcnew
InvalidOperationException
(
"Failed closing file."
);
}
\ No newline at end of file
PcapDotNet/src/PcapDotNet.Core/OfflinePacketCommunicator.h
View file @
87a83787
...
...
@@ -24,16 +24,10 @@ namespace PcapDotNet { namespace Core
/// <exception cref="System::InvalidOperationException">Thrown always.</exception>
virtual
void
Transmit
(
PacketSendBuffer
^
sendBuffer
,
bool
isSync
)
override
;
~
OfflinePacketCommunicator
();
internal
:
OfflinePacketCommunicator
(
System
::
String
^
fileName
);
private
:
pcap_t
*
OpenFile
(
System
::
String
^
filename
);
static
void
CloseFile
(
FILE
*
file
);
FILE
*
_file
;
};
}}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment