Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
emulab-stable
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
emulab
emulab-stable
Commits
179c189f
Commit
179c189f
authored
Sep 28, 2011
by
Mike Hibler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Avoid a pre-mature close of the output fd.
Wait til all other threads have joined.
parent
c5d15a6b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
5 deletions
+15
-5
os/imagezip/imageunzip.c
os/imagezip/imageunzip.c
+15
-5
No files found.
os/imagezip/imageunzip.c
View file @
179c189f
...
...
@@ -156,6 +156,9 @@ static void threadinit(void);
static
void
threadwait
(
void
);
static
void
threadquit
(
void
);
static
void
*
DiskWriter
(
void
*
arg
);
#ifdef FRISBEE
extern
void
(
*
DiskStatusCallback
)(
int
);
#endif
static
int
writeinprogress
;
/* XXX */
static
pthread_t
child_pid
;
...
...
@@ -1070,12 +1073,19 @@ ImageUnzipFlush(void)
threadwait
();
if
(
outfd
>=
0
)
{
if
(
DiskStatusCallback
)
(
*
DiskStatusCallback
)(
3
);
/* can return EINVAL if device doesn't support fsync */
if
(
fsync
(
outfd
)
<
0
&&
errno
!=
EINVAL
)
{
perror
(
"fsync"
);
rv
=
-
1
;
}
close
(
outfd
);
if
(
DiskStatusCallback
)
(
*
DiskStatusCallback
)(
4
);
/* XXX don't close it here, wait til UnzipQuit */
}
return
(
rv
);
...
...
@@ -1090,6 +1100,10 @@ ImageUnzipQuit(void)
if
(
slice
&&
dostype
>=
0
)
fixmbr
(
slice
,
dostype
);
/* Now we can close it */
if
(
outfd
>=
0
)
close
(
outfd
);
#ifdef WITH_CRYPTO
#ifdef SIGN_CHECKSUM
if
(
do_checksum
)
...
...
@@ -1168,10 +1182,6 @@ threadquit(void)
pthread_join
(
child_pid
,
&
ignored
);
}
#ifdef FRISBEE
extern
void
(
*
DiskStatusCallback
)(
int
);
#endif
void
*
DiskWriter
(
void
*
arg
)
{
...
...
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