Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
pike
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pikelang
pike
Commits
d3ef71cb
Commit
d3ef71cb
authored
29 years ago
by
Fredrik Hübinette (Hubbe)
Browse files
Options
Downloads
Patches
Plain Diff
fixed to check more for EINTR
Rev: src/modules/files/file.c:1.3 Rev: src/modules/files/socket.c:1.2
parent
e2712ad1
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/modules/files/file.c
+20
-20
20 additions, 20 deletions
src/modules/files/file.c
src/modules/files/socket.c
+5
-2
5 additions, 2 deletions
src/modules/files/socket.c
with
25 additions
and
22 deletions
src/modules/files/file.c
+
20
−
20
View file @
d3ef71cb
...
@@ -76,7 +76,20 @@ static int close_fd(int fd)
...
@@ -76,7 +76,20 @@ static int close_fd(int fd)
{
{
return
0
;
return
0
;
}
else
{
}
else
{
return
close
(
fd
);
while
(
1
)
{
if
(
close
(
fd
)
>=
0
)
return
0
;
switch
(
errno
)
{
default:
fatal
(
"Unknown error in close().
\n
"
);
case
EBADF
:
fatal
(
"Closing a non-active file descriptor.
\n
"
);
case
EINTR
:
}
}
}
}
}
}
...
@@ -408,6 +421,7 @@ static void file_open(INT32 args)
...
@@ -408,6 +421,7 @@ static void file_open(INT32 args)
THIS
->
errno
=
0
;
THIS
->
errno
=
0
;
retry:
fd
=
open
(
sp
[
-
args
].
u
.
string
->
str
,
map
(
flags
),
00666
);
fd
=
open
(
sp
[
-
args
].
u
.
string
->
str
,
map
(
flags
),
00666
);
if
(
fd
>=
MAX_OPEN_FILEDESCRIPTORS
)
if
(
fd
>=
MAX_OPEN_FILEDESCRIPTORS
)
...
@@ -418,6 +432,9 @@ static void file_open(INT32 args)
...
@@ -418,6 +432,9 @@ static void file_open(INT32 args)
}
}
else
if
(
fd
<
0
)
else
if
(
fd
<
0
)
{
{
if
(
errno
==
EINTR
)
goto
retry
;
THIS
->
errno
=
errno
;
THIS
->
errno
=
errno
;
}
}
else
else
...
@@ -482,8 +499,10 @@ static void file_stat(INT32 args)
...
@@ -482,8 +499,10 @@ static void file_stat(INT32 args)
pop_n_elems
(
args
);
pop_n_elems
(
args
);
retry:
if
(
fstat
(
THIS
->
fd
,
&
s
)
<
0
)
if
(
fstat
(
THIS
->
fd
,
&
s
)
<
0
)
{
{
if
(
errno
==
EINTR
)
goto
retry
;
THIS
->
errno
=
errno
;
THIS
->
errno
=
errno
;
push_int
(
0
);
push_int
(
0
);
}
else
{
}
else
{
...
@@ -1145,22 +1164,6 @@ void exit_files()
...
@@ -1145,22 +1164,6 @@ void exit_files()
free_program
(
file_program
);
free_program
(
file_program
);
}
}
static
RETSIGTYPE
sig_child
(
int
arg
)
{
#ifdef HAVE_WAITPID
waitpid
(
-
1
,
0
,
WNOHANG
);
signal
(
SIGCHLD
,
sig_child
);
#else
#ifdef HAVE_WAIT3
wait3
(
-
1
,
0
,
WNOHANG
);
signal
(
SIGCHLD
,
sig_child
);
#else
/* Leave'em hanging */
#endif
/* HAVE_WAIT3 */
#endif
/* HAVE_WAITPID */
}
void
init_files_programs
()
void
init_files_programs
()
{
{
...
@@ -1175,9 +1178,6 @@ void init_files_programs()
...
@@ -1175,9 +1178,6 @@ void init_files_programs()
reference_fd
(
1
);
reference_fd
(
1
);
reference_fd
(
2
);
reference_fd
(
2
);
signal
(
SIGCHLD
,
sig_child
);
signal
(
SIGPIPE
,
SIG_IGN
);
start_new_program
();
start_new_program
();
add_storage
(
sizeof
(
struct
file
));
add_storage
(
sizeof
(
struct
file
));
...
...
This diff is collapsed.
Click to expand it.
src/modules/files/socket.c
+
5
−
2
View file @
d3ef71cb
...
@@ -56,9 +56,13 @@ struct port
...
@@ -56,9 +56,13 @@ struct port
static
void
do_close
(
struct
port
*
p
)
static
void
do_close
(
struct
port
*
p
)
{
{
retry:
if
(
p
->
fd
>=
0
)
if
(
p
->
fd
>=
0
)
{
{
close
(
p
->
fd
);
if
(
close
(
p
->
fd
)
<
0
)
if
(
errno
==
RETRY
)
goto
retry
;
set_read_callback
(
p
->
fd
,
0
,
0
);
set_read_callback
(
p
->
fd
,
0
,
0
);
}
}
...
@@ -186,7 +190,6 @@ static void port_bind(INT32 args)
...
@@ -186,7 +190,6 @@ static void port_bind(INT32 args)
set_close_on_exec
(
fd
,
1
);
set_close_on_exec
(
fd
,
1
);
if
(
args
>
2
&&
sp
[
2
-
args
].
type
==
T_STRING
)
if
(
args
>
2
&&
sp
[
2
-
args
].
type
==
T_STRING
)
{
{
get_inet_addr
(
&
addr
,
sp
[
2
-
args
].
u
.
string
->
str
);
get_inet_addr
(
&
addr
,
sp
[
2
-
args
].
u
.
string
->
str
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment