mirror of
https://github.com/xcat2/xcat-core.git
synced 2025-06-14 02:10:23 +00:00
fix issue 5633, use noempty file to check tftp service (#5691)
This commit is contained in:
@ -375,16 +375,18 @@ sub is_tftp_ready {
|
||||
rename("/$test_dir/tftptestt.tmp", "/$test_dir/tftptestt.tmp.old") if (-e "/$test_dir/tftptestt.tmp");
|
||||
rename("./tftptestt.tmp", "./tftptestt.tmp.old") if (-e "./tftptestt.tmp");
|
||||
|
||||
system("touch /$test_dir/tftptestt.tmp");
|
||||
system("date > /$test_dir/tftptestt.tmp");
|
||||
my $output = `tftp -4 -v $mnip -c get /tftptest/tftptestt.tmp 2>&1`;
|
||||
if ((!$?) && (-e "./tftptestt.tmp")) {
|
||||
if ((!$?) && (-s "./tftptestt.tmp")) {
|
||||
unlink("./tftptestt.tmp");
|
||||
rename("./tftptestt.tmp.old", "./tftptestt.tmp") if (-e "./tftptestt.tmp.old");
|
||||
rename("/$test_dir/tftptestt.tmp.old", "/$test_dir/tftptestt.tmp") if (-e "/$test_dir/tftptestt.tmp.old");
|
||||
system("rm -rf $test_dir");
|
||||
return 1;
|
||||
} else {
|
||||
rename("./tftptestt.tmp.old", "./tftptestt.tmp") if (-e "./tftptestt.tmp.old");
|
||||
rename("/$test_dir/tftptestt.tmp.old", "/$test_dir/tftptestt.tmp") if (-e "/$test_dir/tftptestt.tmp.old");
|
||||
system("rm -rf $test_dir");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user