Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
net-tools
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
net-tools
Commits
992a1def
Commit
992a1def
authored
Jun 21, 2012
by
Jiri Popelka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
iptunnel.c: avoid fd leak in case of ioctl() error
parent
53c40178
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
0 deletions
+3
-0
iptunnel.c
iptunnel.c
+3
-0
No files found.
iptunnel.c
View file @
992a1def
...
...
@@ -106,6 +106,7 @@ static int do_ioctl_get_ifindex(char *dev)
err
=
ioctl
(
fd
,
SIOCGIFINDEX
,
&
ifr
);
if
(
err
)
{
perror
(
"ioctl"
);
close
(
fd
);
return
0
;
}
close
(
fd
);
...
...
@@ -123,6 +124,7 @@ static int do_ioctl_get_iftype(char *dev)
err
=
ioctl
(
fd
,
SIOCGIFHWADDR
,
&
ifr
);
if
(
err
)
{
perror
(
"ioctl"
);
close
(
fd
);
return
-
1
;
}
close
(
fd
);
...
...
@@ -141,6 +143,7 @@ static char * do_ioctl_get_ifname(int idx)
err
=
ioctl
(
fd
,
SIOCGIFNAME
,
&
ifr
);
if
(
err
)
{
perror
(
"ioctl"
);
close
(
fd
);
return
NULL
;
}
close
(
fd
);
...
...
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