Added more santiy checks
This commit is contained in:
parent
98892c9c03
commit
4672030dba
Binary file not shown.
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
.check_md5.php.swp
|
@ -84,8 +84,9 @@ Options:
|
|||||||
EOD;
|
EOD;
|
||||||
// Print the help
|
// Print the help
|
||||||
print_version();
|
print_version();
|
||||||
echo "$AUTHOR\n";
|
fwrite(STDOUT, "\n");
|
||||||
echo "\n$HELP_TEXT\n";
|
fwrite(STDOUT, "$AUTHOR\n");
|
||||||
|
fwrite(STDOUT, "\n$HELP_TEXT\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -98,8 +99,10 @@ $longoptions = array("warning", "file=", "md5=");
|
|||||||
$args = $options->readPHPArgv();
|
$args = $options->readPHPArgv();
|
||||||
$ret = $options->getopt($args, $shortoptions, $longoptions);
|
$ret = $options->getopt($args, $shortoptions, $longoptions);
|
||||||
|
|
||||||
if (PEAR::isError($ret)) {
|
if (PEAR::isError($ret))
|
||||||
fwrite(STDERR,$ret->getMessage() . "\n");
|
{
|
||||||
|
fwrite(STDERR,$ret->getMessage() . "\n\n");
|
||||||
|
print_help();
|
||||||
exit ($STATE_UNKNOWN);
|
exit ($STATE_UNKNOWN);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -144,6 +147,12 @@ if (empty($filename))
|
|||||||
exit($STATE_UNKNOWN);
|
exit($STATE_UNKNOWN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (file_exists($filename) == FALSE)
|
||||||
|
{
|
||||||
|
fwrite(STDERR, "File $filename does not exsist!\n");
|
||||||
|
exit($STATE_UNKNOWN);
|
||||||
|
}
|
||||||
|
|
||||||
if (empty($md5))
|
if (empty($md5))
|
||||||
{
|
{
|
||||||
fwrite(STDERR,"You need to enter an MD5 checksum\n");
|
fwrite(STDERR,"You need to enter an MD5 checksum\n");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user