From 51ff0a2c49d96215ae88f294b7374be7b2d54e82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johnny=20Bergstr=C3=B6m?= Date: Sun, 29 May 2005 16:36:35 +0000 Subject: [PATCH] Added stock file_copy to file.inc. Also fixed fopen to return 0 on files that can't be opened. Fixed native fopen to take const filename. --- amxmodx/file.cpp | 6 ++++++ plugins/include/file.inc | 38 ++++++++++++++++++++++++++++++++++++-- 2 files changed, 42 insertions(+), 2 deletions(-) diff --git a/amxmodx/file.cpp b/amxmodx/file.cpp index 9b0f50a1..9c210969 100755 --- a/amxmodx/file.cpp +++ b/amxmodx/file.cpp @@ -293,7 +293,13 @@ static cell AMX_NATIVE_CALL amx_fopen(AMX *amx, cell *params) int len, j=-1; char *file = build_pathname("%s", get_amxstring(amx, params[1], 1, len)); char *flags = get_amxstring(amx, params[2], 0, len); + FILE *fp = fopen(file, flags); + if (fp == NULL) { + // Failed + return 0; + } + for (i=0; i