diff options
author | Scott Ullrich <sullrich@pfsense.org> | 2007-11-24 01:26:52 +0000 |
---|---|---|
committer | Scott Ullrich <sullrich@pfsense.org> | 2007-11-24 01:26:52 +0000 |
commit | a2bb45861aeaf35b02d278a97a428dc774b8b347 (patch) | |
tree | e71383ed19ec8cda81d63c6b7b86780a799369cf | |
parent | 9fa767282bbe9911426f6fa9d37d7224239aed44 (diff) | |
download | pfsense-a2bb45861aeaf35b02d278a97a428dc774b8b347.zip pfsense-a2bb45861aeaf35b02d278a97a428dc774b8b347.tar.gz |
edit.php show an error on opening an empty file
Ticket #1519
-rwxr-xr-x | usr/local/www/edit.php | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/usr/local/www/edit.php b/usr/local/www/edit.php index bae8b78..e960831 100755 --- a/usr/local/www/edit.php +++ b/usr/local/www/edit.php @@ -31,7 +31,7 @@ require("guiconfig.inc"); if (($_GET['submit'] == "Load") && file_exists($_GET['savetopath'])) { $fd = fopen($_GET['savetopath'], "r"); - $content = fread($fd, filesize($_GET['savetopath'])); + if ((filesize($_GET['savetopath']) != 0)) { $content = fread($fd, filesize($_GET['savetopath'])); } else { $content = ""; } fclose($fd); $edit_area=""; $loadmsg = gettext("Loaded text from")." " . $_GET['savetopath']; @@ -49,7 +49,7 @@ if (($_GET['submit'] == "Load") && file_exists($_GET['savetopath'])) { if (($_POST['submit'] == "Load") && file_exists($_POST['savetopath'])) { $fd = fopen($_POST['savetopath'], "r"); - $content = fread($fd, filesize($_POST['savetopath'])); + if ((filesize($_POST['savetopath']) != "0")) { $content = fread($fd, filesize($_POST['savetopath'])); } else { $content = ""; } fclose($fd); $edit_area=""; $loadmsg = "Loaded text from " . $_POST['savetopath']; |