Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
emulab
emulab-devel
Commits
575ac4bc
Commit
575ac4bc
authored
Dec 08, 2005
by
Mike Hibler
Browse files
Make sure the ownership of the image files is correct.
parent
4b74ef96
Changes
1
Hide whitespace changes
Inline
Side-by-side
os/create-swapimage
View file @
575ac4bc
...
...
@@ -132,6 +132,13 @@ if (-e $filename) {
}
}
#
# Create the new file now so it is owned by the user and not root
#
if
(
!
open
(
FILE
,
"
>
$filename
")
||
!
close
(
FILE
))
{
goto
failed
;
}
#
# XXX tmp hack: see if there is a newer version of the image zipper.
# This way we do not have to update the admin MFS everytime we want to
...
...
@@ -149,21 +156,21 @@ if (-x "/proj/$pid/bin/$zipperbin") {
#
print
STDERR
"
$me
: doing '
$sudo
$zipper
$args
$device
$filename
'
\n
"
if
(
$debug
);
if
(
system
("
$sudo
$zipper
$args
$device
$filename
"))
{
print
STDERR
"
*** Failed to create image!
\n
";
if
(
system
("
$sudo
$zipper
$args
$device
$filename
")
==
0
)
{
#
# Get rid of the backup image
#
if
(
$ofilename
ne
"")
{
print
STDERR
"
Restoring old image
\n
";
rename
(
$ofilename
,
$filename
)
or
warn
("
Could not restore old image file!
\n
");
unlink
(
$ofilename
);
}
exit
1
;
exit
0
;
}
#
# Get rid of the backup image
#
failed:
print
STDERR
"
*** Failed to create image
$filename
!
\n
";
if
(
$ofilename
ne
"")
{
unlink
(
$ofilename
);
print
STDERR
"
Restoring old image
\n
";
rename
(
$ofilename
,
$filename
)
or
warn
("
Could not restore old image file!
\n
");
}
exit
0
;
exit
1
;
Write
Preview
Supports
Markdown
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