summaryrefslogtreecommitdiff
path: root/ext/informix
diff options
context:
space:
mode:
authorCorne' Cornelius <nobbie@php.net>2003-07-01 13:27:04 +0000
committerCorne' Cornelius <nobbie@php.net>2003-07-01 13:27:04 +0000
commit294cabb35fd0471f5b41a9fe3db9ee90107a1c42 (patch)
tree420cbbf8de2487966c72ecb7550a41fa2f85074a /ext/informix
parent090328fd32175f3dfd4c9cd146f49236efe154c7 (diff)
downloadphp-git-294cabb35fd0471f5b41a9fe3db9ee90107a1c42.tar.gz
- MFB: 1.69.2.18
Diffstat (limited to 'ext/informix')
-rw-r--r--ext/informix/ifx.ec28
1 files changed, 14 insertions, 14 deletions
diff --git a/ext/informix/ifx.ec b/ext/informix/ifx.ec
index 1c76add526..a245876796 100644
--- a/ext/informix/ifx.ec
+++ b/ext/informix/ifx.ec
@@ -3043,20 +3043,20 @@ static long php_intifx_create_blob(long type, long mode, char* param, long len,
if (*param && param != "") {
- char *filename;
-
- if (Ifx_blob->BLOB.blob_data.loc_fname != NULL) {
- unlink(Ifx_blob->BLOB.blob_data.loc_fname);
- efree(Ifx_blob->BLOB.blob_data.loc_fname);
- }
- if ((filename = emalloc(len + 1)) == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can't create blob-resource");
- return -1;
- }
- memcpy(filename, param, len);
- filename[len] = 0;
- Ifx_blob->BLOB.blob_data.loc_fname = filename;
- Ifx_blob->BLOB.blob_data.loc_size = -1;
+ /*
+ * copy the filename in param to filename in loc_fname
+ * otherwise we'll unlink non-temporary files
+ *
+ * loc_fname gets filled by php_intifx_init_blob_infile
+ */
+
+ if (Ifx_blob->BLOB.blob_data.loc_fname != NULL) {
+ if (php_copy_file(param, Ifx_blob->BLOB.blob_data.loc_fname TSRMLS_CC) == FAILURE) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can't create blob-resource file. File copy failed: %s", param);
+ return -1;
+ }
+ Ifx_blob->BLOB.blob_data.loc_size = -1;
+ }
}
}